MutableSet

A generic unordered collection of elements that does not support duplicate elements, and supports adding and removing elements.

Since Kotlin

1.0

Parameters

E

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

Functions

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

Adds the specified element to the set.

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

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

Since Kotlin 1.0
Link copied to clipboard
abstract override fun clear()

Removes all elements from this collection.

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

Checks if the specified element is contained in this collection.

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

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

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

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

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

Returns an iterator over the elements of this object.

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

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

Since Kotlin 1.0
Link copied to clipboard
abstract override 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
Link copied to clipboard
abstract override fun retainAll(elements: Collection<E>): Boolean

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

Since Kotlin 1.0

Properties

Link copied to clipboard
abstract override val size: Int

Returns the size of the collection.

Since Kotlin 1.0

Extensions

Link copied to clipboard
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

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

Since Kotlin 1.0
Link copied to clipboard
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?
Since Kotlin 1.0
Link copied to clipboard
fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?
Since Kotlin 1.0
Link copied to clipboard
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?
Since Kotlin 1.0
Link copied to clipboard
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>

Returns a new SortedSet of all elements.

Since Kotlin 1.0
Link copied to clipboard
actual inline fun <T> Collection<T>.toTypedArray(): Array<T>

Returns a typed array containing all of the elements of this collection.

Since Kotlin 1.0