Google is committed to advancing racial equity for Black communities. See how.

SnapshotStateMap

@Stable class SnapshotStateMap<K, V> : MutableMap<K, V>, StateObject
kotlin.Any
   ↳ androidx.compose.runtime.snapshots.SnapshotStateMap

An implementation of MutableMap that can be observed and snapshot. This is the result type created by androidx.compose.mutableStateMapOf.

This class closely implements the same semantics as HashMap.

Summary

Nested classes

Implementation class of SnapshotStateMap.

Public constructors

An implementation of MutableMap that can be observed and snapshot.

Public methods
Unit

Boolean
containsKey(key: K)

Boolean
containsValue(value: V)

V?
get(key: K)

Boolean

Unit

Add a new state record to the beginning of a list.

V?
put(key: K, value: V)

Unit
putAll(from: Map<out K, V>)

V?
remove(key: K)

Inherited functions
Properties
MutableSet<MutableEntry<K, V>>

SnapshotStateMap.StateMapStateRecord<K, V>

The first state record in a linked list of state records.

MutableSet<K>

Int

MutableCollection<V>

Public constructors

<init>

SnapshotStateMap()

An implementation of MutableMap that can be observed and snapshot. This is the result type created by androidx.compose.mutableStateMapOf.

This class closely implements the same semantics as HashMap.

Public methods

clear

fun clear(): Unit

containsKey

fun containsKey(key: K): Boolean

containsValue

fun containsValue(value: V): Boolean

get

fun get(key: K): V?

isEmpty

fun isEmpty(): Boolean

prependStateRecord

fun prependStateRecord(value: StateRecord): Unit

Add a new state record to the beginning of a list. After this call firstStateRecord should be value.

put

fun put(
    key: K,
    value: V
): V?

putAll

fun putAll(from: Map<out K, V>): Unit

remove

fun remove(key: K): V?

Properties

entries

val entries: MutableSet<MutableEntry<K, V>>

firstStateRecord

var firstStateRecord: SnapshotStateMap.StateMapStateRecord<K, V>

The first state record in a linked list of state records.

keys

val keys: MutableSet<K>

size

val size: Int

values

val values: MutableCollection<V>