AbstractMutableCollection

JVM
1.1
abstract class AbstractMutableCollection<E> : 
    MutableCollection<E>,
    AbstractCollection<E>
JS
1.1
abstract class AbstractMutableCollection<E> : 
    AbstractCollection<E>,
    MutableCollection<E>
Native
1.3
abstract class AbstractMutableCollection<E> : 
    MutableCollection<E>,
    AbstractCollection<E>

Provides a skeletal implementation of the MutableCollection interface.

Parameters

E - the type of elements contained in the collection. The collection is invariant on its element type.

Constructors

JVM
JS
Native
1.0

<init>

Provides a skeletal implementation of the MutableCollection interface.

<init>()

Functions

JVM
JS
1.0

add

Adds the specified element to the collection.

abstract fun add(element: E): Boolean
JS
Native
1.1

addAll

Adds all of the elements of the specified collection to this collection.

open fun addAll(elements: Collection<E>): Boolean
JS
Native
1.1

clear

Removes all elements from this collection.

open fun clear()
JS
Native
1.1

remove

Removes a single instance of the specified element from this collection, if it is present.

open fun remove(element: E): Boolean
JS
Native
1.1

removeAll

Removes all of this collection's elements that are also contained in the specified collection.

open fun removeAll(elements: Collection<E>): Boolean
JS
Native
1.1

retainAll

Retains only the elements in this collection that are contained in the specified collection.

open fun retainAll(elements: Collection<E>): Boolean
JS
1.1

toJSON

open fun toJSON(): Any

Extension Functions

JVM
1.0

filterIsInstance

Returns a list containing all elements that are instances of specified class.

fun <R> Iterable<*>.filterIsInstance(
    klass: Class<R>
): List<R>
JVM
1.0

filterIsInstanceTo

Appends all elements that are instances of specified class to the given destination.

fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(
    destination: C,
    klass: Class<R>
): C
JVM
1.2

shuffled

Returns a new list with the elements of this list randomly shuffled using the specified random instance as the source of randomness.

fun <T> Iterable<T>.shuffled(random: Random): List<T>
JVM
1.0

toSortedSet

Returns a SortedSet of all elements.

fun <T> Iterable<T>.toSortedSet(
    comparator: Comparator<in T>
): SortedSet<T>
Native
1.3

waitForMultipleFutures

Wait for availability of futures in the collection. Returns set with all futures which have value available for the consumption, i.e. FutureState.COMPUTED

fun <T> Collection<Future<T>>.waitForMultipleFutures(
    millis: Int
): Set<Future<T>>

Inheritors

AbstractMutableList

Provides a skeletal implementation of the MutableList interface.

Common
1.0
abstract class AbstractMutableList<E> : MutableList<E>
JVM
1.1
abstract class AbstractMutableList<E> : 
    MutableList<E>,
    AbstractList<E>
JS
Native
1.1
abstract class AbstractMutableList<E> : 
    AbstractMutableCollection<E>,
    MutableList<E>

AbstractMutableSet

Provides a skeletal implementation of the MutableSet interface.

Common
1.0
abstract class AbstractMutableSet<E> : MutableSet<E>
JVM
1.1
abstract class AbstractMutableSet<E> : 
    MutableSet<E>,
    AbstractSet<E>
JS
Native
1.1
abstract class AbstractMutableSet<E> : 
    AbstractMutableCollection<E>,
    MutableSet<E>

ArrayList

Provides a MutableList implementation, which uses a resizable array as its backing storage.

Common
1.0
class ArrayList<E> : MutableList<E>, RandomAccess
JVM
1.1
typealias ArrayList<E> = ArrayList<E>
JS
1.1
open class ArrayList<E> : 
    AbstractMutableList<E>,
    MutableList<E>,
    RandomAccess
Native
1.3
class ArrayList<E> : 
    MutableList<E>,
    RandomAccess,
    AbstractMutableCollection<E>

HashSet

The implementation of the MutableSet interface, backed by a HashMap instance.

Common
1.0
class HashSet<E> : MutableSet<E>
JVM
1.1
typealias HashSet<E> = HashSet<E>
JS
1.1
open class HashSet<E> : AbstractMutableSet<E>, MutableSet<E>
Native
1.3
class HashSet<E> : 
    MutableSet<E>,
    AbstractMutableCollection<E>,
    KonanSet<E>