MutableCollection

A generic collection of elements that supports adding and removing elements.

Since Kotlin

1.0

A generic collection of elements that supports adding and removing elements.

Since Kotlin

1.1

Parameters

E

the type of elements contained in the collection. The mutable collection is invariant in its element type.

E

the type of elements contained in the collection. The mutable collection is invariant in its element type.

Functions

Link copied to clipboard
abstract fun add(element: E): Boolean

Adds the specified element to the collection.

Since Kotlin 1.0
abstract fun add(element: E): Boolean

Adds the specified element to the collection.

Since Kotlin 1.1
Link copied to clipboard
abstract fun addAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.0
abstract fun addAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.1
Link copied to clipboard
abstract fun clear()

Removes all elements from this collection.

Since Kotlin 1.0
abstract fun clear()

Removes all elements from this collection.

Since Kotlin 1.1
Link copied to clipboard
abstract operator fun contains(element: E): Boolean

Checks if the specified element is contained in this collection.

Since Kotlin 1.0
abstract operator fun contains(element: E): Boolean

Checks if the specified element is contained in this collection.

Since Kotlin 1.1
Link copied to clipboard
abstract fun containsAll(elements: Collection<E>): Boolean

Checks if all elements in the specified collection are contained in this collection.

Since Kotlin 1.0
abstract fun containsAll(elements: Collection<E>): Boolean

Checks if all elements in the specified collection are contained in this collection.

Since Kotlin 1.1
Link copied to clipboard
abstract fun isEmpty(): Boolean

Returns true if the collection is empty (contains no elements), false otherwise.

Since Kotlin 1.0
abstract fun isEmpty(): Boolean

Returns true if the collection is empty (contains no elements), false otherwise.

Since Kotlin 1.1
Link copied to clipboard
abstract operator override fun iterator(): MutableIterator<E>

Returns an iterator over the elements of this object.

Since Kotlin 1.0
abstract operator override fun iterator(): MutableIterator<E>

Returns an iterator over the elements of this object.

Since Kotlin 1.1
Link copied to clipboard
abstract fun remove(element: E): Boolean

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

Since Kotlin 1.0
abstract fun remove(element: E): Boolean

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

Since Kotlin 1.1
Link copied to clipboard
abstract fun removeAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.0
abstract fun removeAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.1
Link copied to clipboard
abstract fun retainAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.0
abstract fun retainAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.1

Properties

Link copied to clipboard
abstract val size: Int

Returns the size of the collection.

Since Kotlin 1.0
abstract val size: Int

Returns the size of the collection.

Since Kotlin 1.1

Inheritors

Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R>
fun <R> Iterable<*>.filterIsInstance(klass: Class<R>): List<R>

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

Since Kotlin 1.0
Link copied to clipboard
fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C
fun <C : MutableCollection<in R>, R> Iterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C

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

Since Kotlin 1.0
Link copied to clipboard
Since Kotlin 1.1
fun <T : Comparable<T>> Iterable<T>.max(): T?
fun <T : Comparable<T>> Iterable<T>.max(): T?
Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R : Comparable<R>> Iterable<T>.maxBy(selector: (T) -> R): T?
inline fun <T, R : Comparable<R>> Iterable<T>.maxBy(selector: (T) -> R): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?
fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?
Since Kotlin 1.0
Link copied to clipboard
Since Kotlin 1.1
fun <T : Comparable<T>> Iterable<T>.min(): T?
fun <T : Comparable<T>> Iterable<T>.min(): T?
Since Kotlin 1.0
Link copied to clipboard
inline fun <T, R : Comparable<R>> Iterable<T>.minBy(selector: (T) -> R): T?
inline fun <T, R : Comparable<R>> Iterable<T>.minBy(selector: (T) -> R): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.minWith(comparator: Comparator<in T>): T?
fun <T> Iterable<T>.minWith(comparator: Comparator<in T>): T?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.toSortedSet(comparator: Comparator<in T>): SortedSet<T>
fun <T> Iterable<T>.toSortedSet(comparator: Comparator<in T>): SortedSet<T>

Returns a new SortedSet of all elements.

Since Kotlin 1.0