<div class='sourceset sourceset-common'>Common</div>

```kotlin
class SlotIdsSet
    internal constructor(
        @PublishedApi
        internal val set: MutableOrderedScatterSet<Any?> = mutableOrderedScatterSetOf()
    ) : Collection<Any?>
```

Set containing slot ids currently available to reuse. Used by `getSlotsToRetain`. The set
retains the insertion order of its elements, guaranteeing stable iteration order.

This class works exactly as `MutableSet`, but doesn't allow to add new items in it.

## Functions

<h2 id="remove-slotid">remove</h2>

```kotlin
fun remove(slotId: Any?): Boolean
```

Removes a `slotId` from this set, if it is present.

#### Returns

| | |
| --- | --- |
|  | `true` if the slot id was removed, `false` if the set was not modified. |

<hr class="docs-overload-divider">

<h2 id="removeall-slotids">removeAll</h2>

```kotlin
fun removeAll(slotIds: Collection<Any?>): Boolean
```

Removes all slot ids from `slotIds` that are also contained in this set.

#### Returns

| | |
| --- | --- |
|  | `true` if any slot id was removed, `false` if the set was not modified. |

<hr class="docs-overload-divider">

<h2 id="removeall-predicate">removeAll</h2>

```kotlin
fun removeAll(predicate: (Any?) -> Boolean): Boolean
```

Removes all slot ids that match the given `predicate`.

#### Returns

| | |
| --- | --- |
|  | `true` if any slot id was removed, `false` if the set was not modified. |

<hr class="docs-overload-divider">

<h2 id="retainall-slotids">retainAll</h2>

```kotlin
fun retainAll(slotIds: Collection<Any?>): Boolean
```

Retains only the slot ids that are contained in `slotIds`.

#### Returns

| | |
| --- | --- |
|  | `true` if any slot id was removed, `false` if the set was not modified. |

<hr class="docs-overload-divider">

<h2 id="retainall-predicate">retainAll</h2>

```kotlin
fun retainAll(predicate: (Any?) -> Boolean): Boolean
```

Retains only slotIds that match the given `predicate`.

#### Returns

| | |
| --- | --- |
|  | `true` if any slot id was removed, `false` if the set was not modified. |

<hr class="docs-overload-divider">

<h2 id="clear">clear</h2>

```kotlin
fun clear() = set.clear()
```

Removes all slot ids from this set.

<hr class="docs-overload-divider">

<h2 id="trimtosize-maxslotstoretainforreuse">trimToSize</h2>

```kotlin
fun trimToSize(maxSlotsToRetainForReuse: Int) = set.trimToSize(maxSlotsToRetainForReuse)
```

Remove entries until [size](/jetpack-compose/androidx.compose.ui/ui-geometry/classes/Size) equals `maxSlotsToRetainForReuse`. Entries inserted last are
removed first.

<hr class="docs-overload-divider">

<h2 id="foreach-block">forEach</h2>

```kotlin
fun forEach(block: (Any?) -> Unit) = set.forEach(block)
```

Iterates over every element stored in this set by invoking the specified `block` lambda.
The iteration order is the same as the insertion order. It is safe to remove the element
passed to `block` during iteration.

NOTE: This method is obscured by `Collection<T>.forEach` since it is marked with

<hr class="docs-overload-divider">

<h2 id="fastforeach-block">fastForEach</h2>

```kotlin
inline fun fastForEach(block: (Any?) -> Unit) = set.forEach(block)
```

Iterates over every element stored in this set by invoking the specified `block` lambda.
The iteration order is the same as the insertion order. It is safe to remove the element
passed to `block` during iteration.

NOTE: this method was added in order to allow for a more performant forEach method. It is
necessary because [forEach](/jetpack-compose/androidx.compose.foundation/foundation/functions/forEach) is obscured by `Collection<T>.forEach` since it is marked
with @HidesMember.