# MutableOrderedScatterSet

Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/OrderedScatterSet.kt+class:androidx.collection.MutableOrderedScatterSet) Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  class MutableOrderedScatterSet<E : Any?> : OrderedScatterSet<E>
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.collection.OrderedScatterSet](https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet)\<E\> ||
|   | ↳ | [androidx.collection.MutableOrderedScatterSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet) |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet` is a container with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html`-like interface based on a flat hash table implementation that preserves the insertion order for iteration. The underlying implementation is designed to avoid all allocations on insertion, removal, retrieval, and iteration. Allocations may still happen on insertion when the underlying storage needs to grow to accommodate newly added elements to the set.

This implementation guarantees the order of the elements when iterating over them using `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#forEach(kotlin.Function1)` or the iterator provided by `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#asMutableSet()`.

This implementation is not thread-safe: if multiple threads access this container concurrently, and one or more threads modify the structure of the set (insertion or removal for instance), the calling code must provide the appropriate synchronization. Concurrent reads are however safe.

**Note** : when a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` is absolutely necessary, you can use the method `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#asSet()` to create a thin wrapper around a `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet`. Please refer to `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#asSet()` for more details and caveats.

**Note** : when a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` is absolutely necessary, you can use the method `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#asMutableSet()` to create a thin wrapper around a `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet`. Please refer to `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#asMutableSet()` for more details and caveats.

| See also |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` |   |

## Summary

| ### Public constructors |
|---|---|
| `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#MutableOrderedScatterSet(kotlin.Int)(initialCapacity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates a new `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet` | Cmn |

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#add(kotlin.Any)(element: E)` Adds the specified element to the set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.Array)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>)` Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.Array)` into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.collections.Iterable)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>)` Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.collections.Iterable)` into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.ObjectList)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>)` Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.ObjectList)` set into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.OrderedScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>)` Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.OrderedScatterSet)` set into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.ScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>)` Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.ScatterSet)` set into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.sequences.Sequence)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>)` Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.sequences.Sequence)` into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html<E>` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#asMutableSet()()` Wraps this `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` interface. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#clear()()` Removes all elements from this set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.Any)(element: E)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.Any)` from the set if it is present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.Array)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.Array)` from the set, if present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.collections.Iterable)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.collections.Iterable)` from the set, if present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.ObjectList)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.ObjectList)` from the set, if present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.OrderedScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.OrderedScatterSet)` from the set, if present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.ScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.ScatterSet)` from the set, if present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.sequences.Sequence)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.sequences.Sequence)` from the set, if present. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.Any)(element: E)` Adds the specified element to the set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.Array)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>)` Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.Array)` into this set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.collections.Iterable)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>)` Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.collections.Iterable)` into this set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.ObjectList)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>)` Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.ObjectList)` set into this set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.OrderedScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>)` Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.OrderedScatterSet)` set into this set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.ScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>)` Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.ScatterSet)` set into this set. | Cmn |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.sequences.Sequence)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>)` Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.sequences.Sequence)` into this set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#remove(kotlin.Any)(element: E)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#remove(kotlin.Any)` from the set. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.Array)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.Array)` from the set, if present. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.collections.Iterable)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.collections.Iterable)` from the set, if present. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.ObjectList)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.ObjectList)` from the set, if present. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.OrderedScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.OrderedScatterSet)` from the set, if present. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.ScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.ScatterSet)` from the set, if present. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.sequences.Sequence)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>)` Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.sequences.Sequence)` from the set, if present. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeIf(kotlin.Function1)(predicate: (E) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Removes any values for which the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeIf(kotlin.Function1)` returns true. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(kotlin.collections.Collection)(elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<E>)` Removes all the entries in this set that are not contained in `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(kotlin.collections.Collection)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(androidx.collection.OrderedScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>)` Removes all the entries in this set that are not contained in `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(androidx.collection.OrderedScatterSet)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(androidx.collection.ScatterSet)(elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>)` Removes all the entries in this set that are not contained in `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(androidx.collection.ScatterSet)`. | Cmn |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(kotlin.Function1)(predicate: (E) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Removes all the elements in this set for which the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(kotlin.Function1)` is `true`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#trim()()` Trims this `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet`'s storage so it is sized appropriately to hold the current elements. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#trimToSize(kotlin.Int)(maxSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Remove entries until the total size of the remaining entries is less than or equal to `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#trimToSize(kotlin.Int)`. | Cmn |

### Inherited functions

From [androidx.collection.OrderedScatterSet](https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet) `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#all(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns true if all elements match the given `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#all(kotlin.Function1)`.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#any()()`

Returns `true` if this set has at least one element.
Cmn `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#any(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns true if at least one element matches the given `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#any(kotlin.Function1)`.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<E>` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#asSet()()`

Wraps this `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` interface.
Cmn `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#contains(kotlin.Any)(element: E)`

Returns true if the specified `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#contains(kotlin.Any)` is present in this hash set, false otherwise.
Cmn `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#count()()`

Returns the number of elements in this set.
Cmn `inline @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#count(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns the number of elements matching the given `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#count(kotlin.Function1)`.The order in which the predicate is called over the elements is arbitrary.
Cmn `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

Compares the specified object `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#equals(kotlin.Any)` with this hash set for equality.
Cmn `E` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#first()()`

Returns the first element in the collection.
Cmn `inline E` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#first(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns the first element in insertion order in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#first(kotlin.Function1)` returns `true`.
Cmn `inline E?` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#firstOrNull(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns the first element in insertion order in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#firstOrNull(kotlin.Function1)` returns `true` or `null` if there are no elements that match `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#firstOrNull(kotlin.Function1)`.
Cmn `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#forEach(kotlin.Function1)(block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)`

Iterates over every element stored in this set by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#forEach(kotlin.Function1)` lambda.
Cmn `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#forEachReverse(kotlin.Function1)(block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)`

Iterates over every element stored in this set by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#forEachReverse(kotlin.Function1)` lambda.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#hashCode()()`

Returns the hash code value for this set.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#isEmpty()()`

Indicates whether this set is empty.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#isNotEmpty()()`

Returns `true` if this set is not empty.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)(
separator: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html,
prefix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html,
postfix: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html,
limit: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html,
truncated: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html,
transform: ((E) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)?
)`

Creates a String from the elements separated by `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` and using `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` before and `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` after, if supplied.
Cmn `E` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#last()()`

Returns the last element in the collection.
Cmn `inline E` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#last(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns the last element in insertion order in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#last(kotlin.Function1)` returns `true`.
Cmn `inline E?` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#lastOrNull(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

Returns the first element in insertion order in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#lastOrNull(kotlin.Function1)` returns `true` or `null` if there are no elements that match `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#lastOrNull(kotlin.Function1)`.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#none()()`

Returns `true` if this set has no elements.
Cmn `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<E>` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#toList()()`

Returns a new list containing this set's entries, in insertion order.
Cmn `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#toString()()`

Returns a string representation of this set.
Cmn

### Inherited properties

From [androidx.collection.OrderedScatterSet](https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#capacity()`

Returns the number of elements that can be stored in this set without requiring internal storage reallocation.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#size()`

Returns the number of elements in this set.
Cmn

## Public constructors

### MutableOrderedScatterSet

Cmn

```
<E : Any?> MutableOrderedScatterSet(
    initialCapacity: Int = DefaultScatterCapacity
)
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet`

| Parameters |
|---|---|
| `initialCapacity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = DefaultScatterCapacity` | The initial desired capacity for this container. the container will honor this value by guaranteeing its internal structures can hold that many elements without requiring any allocations. The initial capacity can be set to 0. |

## Public functions

### add

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun add(element: E): Boolean
```

Adds the specified element to the set.

| Parameters |
|---|---|
| `element: E` | The element to add to the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the element has been added or `false` if the element is already contained within the set. |

### addAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun addAll(elements: Array<E>): Boolean
```

Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.Array)` into this set.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>` | An array of elements to add to the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if any of the specified elements were added to the collection, `false` if the collection was not modified. |

### addAll

Cmn

```
fun addAll(elements: Iterable<E>): Boolean
```

Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.collections.Iterable)` into this set.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>` | Iterable elements to add to the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if any of the specified elements were added to the collection, `false` if the collection was not modified. |

### addAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun addAll(elements: ObjectList<E>): Boolean
```

Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.ObjectList)` set into this set.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>` | An `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` whose elements are to be added to the set |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if any of the specified elements were added to the collection, `false` if the collection was not modified. |

### addAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun addAll(elements: OrderedScatterSet<E>): Boolean
```

Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.OrderedScatterSet)` set into this set.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` whose elements are to be added to the set |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if any of the specified elements were added to the collection, `false` if the collection was not modified. |

### addAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun addAll(elements: ScatterSet<E>): Boolean
```

Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(androidx.collection.ScatterSet)` set into this set.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` whose elements are to be added to the set |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if any of the specified elements were added to the collection, `false` if the collection was not modified. |

### addAll

Cmn

```
fun addAll(elements: Sequence<E>): Boolean
```

Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#addAll(kotlin.sequences.Sequence)` into this set.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>` | The sequence of elements to add to the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if any of the specified elements were added to the collection, `false` if the collection was not modified. |

### asMutableSet

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun asMutableSet(): MutableSet<E>
```

Wraps this `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` interface. The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` is backed by the `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet`, so changes to the `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` are reflected in the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` and vice-versa. If the `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` is modified while an iteration over the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` is in progress (and vice- versa), the results of the iteration are undefined.

**Note** : while this method is useful to use this `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet` with APIs accepting `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` interfaces, it is less efficient to do so than to use `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet`'s APIs directly. While the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` implementation returned by this method tries to be as efficient as possible, the semantics of `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html` may require the allocation of temporary objects for access and iteration.

### clear

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun clear(): Unit
```

Removes all elements from this set.

### minusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun minusAssign(element: E): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.Any)` from the set if it is present.

| Parameters |
|---|---|
| `element: E` | The element to be removed from the set. |

### minusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun minusAssign(elements: Array<E>): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.Array)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>` | An array of elements to be removed from the set. |

### minusAssign

Cmn

```
operator fun minusAssign(elements: Iterable<E>): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.collections.Iterable)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>` | A Iterable of elements to be removed from the set. |

### minusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun minusAssign(elements: ObjectList<E>): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.ObjectList)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>` | An `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` whose elements should be removed from the set. |

### minusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun minusAssign(elements: OrderedScatterSet<E>): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.OrderedScatterSet)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` whose elements should be removed from the set. |

### minusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun minusAssign(elements: ScatterSet<E>): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(androidx.collection.ScatterSet)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` whose elements should be removed from the set. |

### minusAssign

Cmn

```
operator fun minusAssign(elements: Sequence<E>): Unit
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#minusAssign(kotlin.sequences.Sequence)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>` | A sequence of elements to be removed from the set. |

### plusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun plusAssign(element: E): Unit
```

Adds the specified element to the set.

| Parameters |
|---|---|
| `element: E` | The element to add to the set. |

### plusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun plusAssign(elements: Array<E>): Unit
```

Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.Array)` into this set.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>` | An array of elements to add to the set. |

### plusAssign

Cmn

```
operator fun plusAssign(elements: Iterable<E>): Unit
```

Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.collections.Iterable)` into this set.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>` | Iterable elements to add to the set. |

### plusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun plusAssign(elements: ObjectList<E>): Unit
```

Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.ObjectList)` set into this set.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>` | An `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` whose elements are to be added to the set |

### plusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun plusAssign(elements: OrderedScatterSet<E>): Unit
```

Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.OrderedScatterSet)` set into this set.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` whose elements are to be added to the set |

### plusAssign

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
operator fun plusAssign(elements: ScatterSet<E>): Unit
```

Adds all the elements in the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(androidx.collection.ScatterSet)` set into this set.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` whose elements are to be added to the set |

### plusAssign

Cmn

```
operator fun plusAssign(elements: Sequence<E>): Unit
```

Adds all the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#plusAssign(kotlin.sequences.Sequence)` into this set.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>` | The sequence of elements to add to the set. |

### remove

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun remove(element: E): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#remove(kotlin.Any)` from the set.

| Parameters |
|---|---|
| `element: E` | The element to be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#remove(kotlin.Any)` was present in the set, or `false` if it wasn't present before removal. |

### removeAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun removeAll(elements: Array<E>): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.Array)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<E>` | An array of elements to be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the set was changed or `false` if none of the elements were present. |

### removeAll

Cmn

```
fun removeAll(elements: Iterable<E>): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.collections.Iterable)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html<E>` | A Iterable of elements to be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the set was changed or `false` if none of the elements were present. |

### removeAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun removeAll(elements: ObjectList<E>): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.ObjectList)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ObjectList<E>` | An `https://developer.android.com/reference/kotlin/androidx/collection/ObjectList` whose elements should be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the set was changed or `false` if none of the elements were present. |

### removeAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun removeAll(elements: OrderedScatterSet<E>): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.OrderedScatterSet)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet` whose elements should be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the set was changed or `false` if none of the elements were present. |

### removeAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun removeAll(elements: ScatterSet<E>): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(androidx.collection.ScatterSet)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>` | A `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` whose elements should be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the set was changed or `false` if none of the elements were present. |

### removeAll

Cmn

```
fun removeAll(elements: Sequence<E>): Boolean
```

Removes the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeAll(kotlin.sequences.Sequence)` from the set, if present.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.sequences/-sequence/index.html<E>` | A sequence of elements to be removed from the set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the set was changed or `false` if none of the elements were present. |

### removeIf

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
inline fun removeIf(predicate: (E) -> Boolean): Unit
```

Removes any values for which the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#removeIf(kotlin.Function1)` returns true.

### retainAll

Cmn

```
fun retainAll(elements: Collection<E>): Boolean
```

Removes all the entries in this set that are not contained in `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(kotlin.collections.Collection)`.

| Parameters |
|---|---|
| `elements: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html<E>` | A collection of elements to preserve in this set. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if this set was modified, `false` otherwise. |

### retainAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun retainAll(elements: OrderedScatterSet<E>): Boolean
```

Removes all the entries in this set that are not contained in `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(androidx.collection.OrderedScatterSet)`.

elements A set of elements to preserve in this set.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if this set was modified, `false` otherwise. |

### retainAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun retainAll(elements: ScatterSet<E>): Boolean
```

Removes all the entries in this set that are not contained in `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(androidx.collection.ScatterSet)`.

elements A set of elements to preserve in this set.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if this set was modified, `false` otherwise. |

### retainAll

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
inline fun retainAll(predicate: (E) -> Boolean): Boolean
```

Removes all the elements in this set for which the specified `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#retainAll(kotlin.Function1)` is `true`. For each element in the set, the predicate is invoked with that element as the sole parameter.

| Parameters |
|---|---|
| `predicate: (E) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Predicate invoked for each element in the set. When the predicate returns `true`, the element is kept in the set, otherwise it is removed. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if this set was modified, `false` otherwise. |

### trim

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun trim(): @IntRange(from = 0) Int
```

Trims this `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet`'s storage so it is sized appropriately to hold the current elements.

Returns the number of empty elements removed from this set's storage. Returns 0 if no trimming is necessary or possible.

### trimToSize

Cmn Added in [1.5.0](https://developer.android.com/jetpack/androidx/releases/collection#1.5.0)

```
fun trimToSize(maxSize: Int): Unit
```

Remove entries until the total size of the remaining entries is less than or equal to `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#trimToSize(kotlin.Int)`. Entries added last are removed first. Calling this method has no effect if `https://developer.android.com/reference/kotlin/androidx/collection/MutableOrderedScatterSet#trimToSize(kotlin.Int)` is greater than `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet#size()`.