# ScatterSet

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  sealed class ScatterSet<E : Any?>
  ```
Known direct subclasses [MutableScatterSet](https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` 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. |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` is a container with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html`-like interface based on a flat hash table implementation. 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 makes no guarantee as to the order of the elements, nor does it make guarantees that the order remains constant over time. If the order of the elements must be preserved, please refer to `https://developer.android.com/reference/kotlin/androidx/collection/OrderedScatterSet`.

Though `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` offers a read-only interface, it is always backed by a `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet`. Read operations alone are thread-safe. However, any mutations done through the backing `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` while reading on another thread are not safe and the developer must protect the set from such changes during read operations.

**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/ScatterSet#asSet()` to create a thin wrapper around a `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet`. Please refer to `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#asSet()` for more details and caveats.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` |   |

## Summary

| ### Protected constructors |
|---|---|
| `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#ScatterSet()()` | android |
| `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#ScatterSet()()` | N |
| `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#ScatterSet()()` | JS |
| `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#ScatterSet(kotlin.collections.MutableSet)(delegate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html<E>)` | JS |

| ### Public functions |
|---|---|---|
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#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/ScatterSet#all(kotlin.Function1)`. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#any()()` Returns `true` if this set has at least one element. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#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/ScatterSet#any(kotlin.Function1)`. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<E>` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#asSet()()` Wraps this `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` interface. | Cmn android N JS |
| `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#contains(kotlin.Any)(element: E)` Returns true if the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#contains(kotlin.Any)` is present in this hash set, false otherwise. | Cmn android N JS |
| `@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/ScatterSet#count()()` Returns the number of elements in this set. | Cmn android N JS |
| `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/ScatterSet#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/ScatterSet#count(kotlin.Function1)`. | Cmn android N JS |
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#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/ScatterSet#equals(kotlin.Any)` with this hash set for equality. | Cmn android N JS |
| `E` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#first()()` Returns the first element in the collection. | Cmn android N JS |
| `inline E` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#first(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the first element in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#first(kotlin.Function1)` returns `true` | Cmn android N JS |
| `inline E?` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)(predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the first element in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)` returns `true` or `null` if there are no elements that match `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)`. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#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/ScatterSet#forEach(kotlin.Function1)` lambda. | Cmn android N JS |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#hashCode()()` Returns the hash code value for this set. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#isEmpty()()` Indicates whether this set is empty. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#isNotEmpty()()` Returns `true` if this set is not empty. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#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/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` and using `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` before and `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` after, if supplied. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#none()()` Returns `true` if this set has no elements. | Cmn android N JS |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#toString()()` Returns a string representation of this set. | Cmn android N JS |

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

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet<E>` | `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>.https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#(androidx.collection.ScatterSet).toMutableScatterSet()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` with the specified contents. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>` | `<E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet<E>.https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#(androidx.collection.ScatterSet).toScatterSet()()` Returns a new read-only `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` with the specified contents. | Cmn |

## Protected constructors

### ScatterSet

android

```
protected <E : Any?> ScatterSet()
```

### ScatterSet

N

```
protected <E : Any?> ScatterSet()
```

### ScatterSet

JS

```
protected <E : Any?> ScatterSet()
```

### ScatterSet

JS

```
protected <E : Any?> ScatterSet(delegate: MutableSet<E>)
```

## Public functions

### all

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

```
inline fun all(predicate: (element) -> Boolean): Boolean
```

Returns true if all elements match the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#all(kotlin.Function1)`. If there are no elements in the set, `true` is returned.

| Parameters |
|---|---|
| `predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | called for elements in the set to determine if it returns return `true` for all elements. |

### any

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

```
fun any(): Boolean
```

Returns `true` if this set has at least one element.

### any

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

```
inline fun any(predicate: (element) -> Boolean): Boolean
```

Returns true if at least one element matches the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#any(kotlin.Function1)`.

| Parameters |
|---|---|
| `predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | called for elements in the set to determine if it returns `true` for any elements. |

### asSet

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

```
fun asSet(): Set<E>
```

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

**Note** : while this method is useful to use this `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` with APIs accepting `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html` interfaces, it is less efficient to do so than to use `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet`'s APIs directly. While the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-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/-set/index.html` may require the allocation of temporary objects for access and iteration.

### contains

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

```
operator fun contains(element: E): Boolean
```

Returns true if the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#contains(kotlin.Any)` is present in this hash set, false otherwise.

| Parameters |
|---|---|
| `element: E` | The element to look for in this set |

### count

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

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

Returns the number of elements in this set.

### count

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

```
inline fun count(predicate: (element) -> Boolean): @IntRange(from = 0) Int
```

Returns the number of elements matching the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#count(kotlin.Function1)`.

| Parameters |
|---|---|
| `predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Called for all elements in the set to count the number for which it returns `true`. |

### equals

Cmn android N JS

```
open operator fun equals(other: Any?): Boolean
```

Compares the specified object `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#equals(kotlin.Any)` with this hash set for equality. The two objects are considered equal if `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#equals(kotlin.Any)`:

- Is a `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet`

- Has the same `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#size()` as this set

- Contains elements equal to this set's elements

### first

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

```
fun first(): E
```

Returns the first element in the collection.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` | if the collection is empty |

### first

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

```
inline fun first(predicate: (element) -> Boolean): E
```

Returns the first element in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#first(kotlin.Function1)` returns `true`

| Parameters |
|---|---|
| `predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | called with each element until it returns `true`. |

| Returns |
|---|---|
| `E` | The element for which `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#first(kotlin.Function1)` returns `true`. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` | if `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#first(kotlin.Function1)` returns `false` for all elements or the collection is empty. |

### firstOrNull

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

```
inline fun firstOrNull(predicate: (element) -> Boolean): E?
```

Returns the first element in the collection for which `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)` returns `true` or `null` if there are no elements that match `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)`.

| Parameters |
|---|---|
| `predicate: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | called with each element until it returns `true`. |

| Returns |
|---|---|
| `E?` | The element for which `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)` returns `true` or `null` if there are no elements in the set or `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#firstOrNull(kotlin.Function1)` returned `false` for every element in the set. |

### forEach

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

```
inline fun forEach(block: (element) -> Unit): Unit
```

Iterates over every element stored in this set by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#forEach(kotlin.Function1)` lambda. It is safe to remove the element passed to `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#forEach(kotlin.Function1)` during iteration.

| Parameters |
|---|---|
| `block: (element) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | called with each element in the set |

### hashCode

Cmn android N JS

```
open fun hashCode(): Int
```

Returns the hash code value for this set. The hash code of a set is based on the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero.

### isEmpty

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

```
fun isEmpty(): Boolean
```

Indicates whether this set is empty.

### isNotEmpty

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

```
fun isNotEmpty(): Boolean
```

Returns `true` if this set is not empty.

### joinToString

Cmn android N JS

```
fun joinToString(
    separator: CharSequence = ", ",
    prefix: CharSequence = "",
    postfix: CharSequence = "",
    limit: Int = -1,
    truncated: CharSequence = "...",
    transform: ((E) -> CharSequence)? = null
): String
```

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

When a non-negative value of `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` is provided, a maximum of `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` items are used to generate the string. If the collection holds more than `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` items, the string is terminated with `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)`.

`https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function1)` may be supplied to convert each element to a custom String.

### none

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

```
fun none(): Boolean
```

Returns `true` if this set has no elements.

### toString

Cmn android N JS

```
open fun toString(): String
```

Returns a string representation of this set. The set is denoted in the string by the `[]`. Each element is separated by `, `.

## Public properties

### capacity

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

```
val capacity: Int
```

Returns the number of elements that can be stored in this set without requiring internal storage reallocation.

### size

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

```
val size: Int
```

Returns the number of elements in this set.

## Extension functions

### ScatterSet.toMutableScatterSet

Cmn Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/ScatterSet.kt+function:toMutableScatterSet)

```
fun <E : Any?> ScatterSet<E>.toMutableScatterSet(): MutableScatterSet<E>
```

Returns a new `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` with the specified contents.

The `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterSet` is created with an initial capacity sufficient to hold the content in the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet`.

### ScatterSet.toScatterSet

Cmn Artifact: [androidx.collection:collection](https://developer.android.com/jetpack/androidx/releases/collection) [View Source](https://cs.android.com/search?q=file:androidx/collection/ScatterSet.kt+function:toScatterSet)

```
fun <E : Any?> ScatterSet<E>.toScatterSet(): ScatterSet<E>
```

Returns a new read-only `https://developer.android.com/reference/kotlin/androidx/collection/ScatterSet` with the specified contents.