# ScatterMap

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  sealed class ScatterMap<K : Any?, V : Any?>
  ```
Known direct subclasses [MutableScatterMap](https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap` | `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap` is a container with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html`-like interface based on a flat hash table implementation (the key/value mappings are not stored by nodes but directly into arrays). |

*** ** * ** ***

`https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap` is a container with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html`-like interface based on a flat hash table implementation (the key/value mappings are not stored by nodes but directly into arrays). 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 entries to the table. In addition, this implementation minimizes memory usage by avoiding the use of separate objects to hold key/value pairs.

This implementation makes no guarantee as to the order of the keys and values stored, nor does it make guarantees that the order remains constant over time.

This implementation is not thread-safe: if multiple threads access this container concurrently, and one or more threads modify the structure of the map (insertion or removal for instance), the calling code must provide the appropriate synchronization. Multiple threads are safe to read from this map concurrently if no write is happening.

This implementation is read-only and only allows data to be queried. A mutable implementation is provided by `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap`.

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

**ScatterMap and SimpleArrayMap** : like `https://developer.android.com/reference/kotlin/androidx/collection/SimpleArrayMap`, `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap`/`https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap` is designed to avoid the allocation of extra objects when inserting new entries in the map. However, the implementation of `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap`/`https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap` offers better performance characteristics compared to `https://developer.android.com/reference/kotlin/androidx/collection/SimpleArrayMap` and is thus generally preferable. If memory usage is a concern, `https://developer.android.com/reference/kotlin/androidx/collection/SimpleArrayMap` automatically shrinks its storage to avoid using more memory than necessary. You can also control memory usage with `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap` by manually calling `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap#trim()`.

**Note**: For the JS target the implementation delegates to a regular map.

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

## Summary

| ### Protected constructors |
|---|---|
| `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#ScatterMap()()` | android |
| `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#ScatterMap()()` | N |
| `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#ScatterMap()()` | JS |
| `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#ScatterMap(kotlin.collections.MutableMap)(delegate: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html<K, V>)` | JS |

| ### Public functions |
|---|---|---|
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#all(kotlin.Function2)(predicate: (K, V) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns true if all entries match the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#all(kotlin.Function2)`. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#any()()` Returns `true` if this map has at least one entry. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#any(kotlin.Function2)(predicate: (K, V) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns true if at least one entry matches the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#any(kotlin.Function2)`. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<K, V>` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#asMap()()` Wraps this `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap` with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/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/ScatterMap#contains(kotlin.Any)(key: K)` Returns true if the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#contains(kotlin.Any)` is present in this hash map, false otherwise. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#containsKey(kotlin.Any)(key: K)` Returns true if the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#containsKey(kotlin.Any)` is present in this hash map, false otherwise. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#containsValue(kotlin.Any)(value: V)` Returns true if the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#containsValue(kotlin.Any)` is present in this hash map, false otherwise. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#count()()` Returns the number of entries in this map. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#count(kotlin.Function2)(predicate: (K, V) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Returns the number of entries matching the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#count(kotlin.Function2)`. | 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/ScatterMap#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/ScatterMap#equals(kotlin.Any)` with this hash map for equality. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEach(kotlin.Function2)(block: (key, value) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Iterates over every key/value pair stored in this map by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEach(kotlin.Function2)` lambda. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEachKey(kotlin.Function1)(block: (key) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Iterates over every key stored in this map by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEachKey(kotlin.Function1)` lambda. | Cmn android N JS |
| `inline https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEachValue(kotlin.Function1)(block: (value) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` Iterates over every value stored in this map by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEachValue(kotlin.Function1)` lambda. | Cmn android N JS |
| `operator V?` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#get(kotlin.Any)(key: K)` Returns the value corresponding to the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#get(kotlin.Any)`, or `null` if such a key is not present in the map. | Cmn android N JS |
| `V` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrDefault(kotlin.Any,kotlin.Any)(key: K, defaultValue: V)` Returns the value to which the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrDefault(kotlin.Any,kotlin.Any)` is mapped, or `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrDefault(kotlin.Any,kotlin.Any)` if this map contains no mapping for the key. | Cmn android N JS |
| `inline V` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrElse(kotlin.Any,kotlin.Function0)(key: K, defaultValue: () -> V)` Returns the value for the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrElse(kotlin.Any,kotlin.Function0)` if the value is present and not null. | Cmn android N JS |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#hashCode()()` Returns the hash code value for this map. | Cmn android N JS |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#isEmpty()()` Indicates whether this map 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/ScatterMap#isNotEmpty()()` Returns `true` if this map 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/ScatterMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)( 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: ((key, value) -> 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/ScatterMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` and using `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` before and `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` 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/ScatterMap#none()()` Returns `true` if this map has no entries. | Cmn android N JS |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#toString()()` Returns a string representation of this map. | 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/ScatterMap#capacity()` Returns the number of key-value pairs that can be stored in this map 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/ScatterMap#size()` Returns the number of key-value pairs in this map. | Cmn android N JS |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap<K, V>` | `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap<K, V>.https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#(androidx.collection.ScatterMap).toMutableScatterMap()()` Returns a new `https://developer.android.com/reference/kotlin/androidx/collection/MutableScatterMap` with the specified mappings. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap<K, V>` | `<K : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap<K, V>.https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#(androidx.collection.ScatterMap).toScatterMap()()` Returns a new read-only `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap` with the specified mappings. | Cmn |

## Protected constructors

### ScatterMap

android

```
protected <K : Any?, V : Any?> ScatterMap()
```

### ScatterMap

N

```
protected <K : Any?, V : Any?> ScatterMap()
```

### ScatterMap

JS

```
protected <K : Any?, V : Any?> ScatterMap()
```

### ScatterMap

JS

```
protected <K : Any?, V : Any?> ScatterMap(delegate: MutableMap<K, V>)
```

## 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: (K, V) -> Boolean): Boolean
```

Returns true if all entries match the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#all(kotlin.Function2)`.

### 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 map has at least one entry.

### 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: (K, V) -> Boolean): Boolean
```

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

### asMap

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

```
fun asMap(): Map<K, V>
```

Wraps this `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap` with a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html` interface. The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html` is backed by the `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap`, so changes to the `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap` are reflected in the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html`. If the `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap` is modified while an iteration over the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/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/ScatterMap` with APIs accepting `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html` interfaces, it is less efficient to do so than to use `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap`'s APIs directly. While the `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/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/-map/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(key: K): Boolean
```

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

### containsKey

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

```
fun containsKey(key: K): Boolean
```

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

### containsValue

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

```
fun containsValue(value: V): Boolean
```

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

### count

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

```
fun count(): Int
```

Returns the number of entries in this map.

### 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: (K, V) -> Boolean): Int
```

Returns the number of entries matching the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#count(kotlin.Function2)`.

### equals

Cmn android N JS

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

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

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

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

- Contains key/value pairs equal to this map's pair

### 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: (key, value) -> Unit): Unit
```

Iterates over every key/value pair stored in this map by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEach(kotlin.Function2)` lambda.

### forEachKey

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

```
inline fun forEachKey(block: (key) -> Unit): Unit
```

Iterates over every key stored in this map by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEachKey(kotlin.Function1)` lambda.

### forEachValue

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

```
inline fun forEachValue(block: (value) -> Unit): Unit
```

Iterates over every value stored in this map by invoking the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#forEachValue(kotlin.Function1)` lambda.

### get

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

```
operator fun get(key: K): V?
```

Returns the value corresponding to the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#get(kotlin.Any)`, or `null` if such a key is not present in the map.

### getOrDefault

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

```
fun getOrDefault(key: K, defaultValue: V): V
```

Returns the value to which the specified `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrDefault(kotlin.Any,kotlin.Any)` is mapped, or `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrDefault(kotlin.Any,kotlin.Any)` if this map contains no mapping for the key.

### getOrElse

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

```
inline fun getOrElse(key: K, defaultValue: () -> V): V
```

Returns the value for the given `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrElse(kotlin.Any,kotlin.Function0)` if the value is present and not null. Otherwise, returns the result of the `https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#getOrElse(kotlin.Any,kotlin.Function0)` function.

### hashCode

Cmn android N JS

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

Returns the hash code value for this map. The hash code the sum of the hash codes of each key/value pair.

### 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 map 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 map is not empty.

### joinToString

Cmn android N JS

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

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

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

`https://developer.android.com/reference/kotlin/androidx/collection/ScatterMap#joinToString(kotlin.CharSequence,kotlin.CharSequence,kotlin.CharSequence,kotlin.Int,kotlin.CharSequence,kotlin.Function2)` 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 map has no entries.

### toString

Cmn android N JS

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

Returns a string representation of this map. The map is denoted in the string by the `{}`. Each key/value pair present in the map is represented inside '{}`by a substring of the form `key=value`, and pairs are 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 key-value pairs that can be stored in this map 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 key-value pairs in this map.

## Extension functions

### ScatterMap.toMutableScatterMap

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

```
fun <K : Any?, V : Any?> ScatterMap<K, V>.toMutableScatterMap(): MutableScatterMap<K, V>
```

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

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

### ScatterMap.toScatterMap

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

```
fun <K : Any?, V : Any?> ScatterMap<K, V>.toScatterMap(): ScatterMap<K, V>
```

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