SnapshotStateSet


An implementation of MutableSet that can be observed and snapshot. This is the result type created by androidx.compose.runtime.mutableStateSetOf.

Summary

Public constructors

Cmn

Public functions

open Boolean
add(element: T)
Cmn
open Boolean
addAll(elements: Collection<T>)
Cmn
open Unit
Cmn
open operator Boolean
contains(element: T)
Cmn
open Boolean
containsAll(elements: Collection<T>)
Cmn
open Boolean
Cmn
open operator MutableIterator<T>
Cmn
open Unit

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

Cmn
open Boolean
remove(element: T)
Cmn
open Boolean
removeAll(elements: Collection<T>)
Cmn
open Boolean
retainAll(elements: Collection<T>)
Cmn
Set<T>

Return a set containing all the elements of this set.

Cmn
open String
Cmn

Public properties

open StateRecord

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

Cmn
open Int
Cmn

Inherited functions

From androidx.compose.runtime.snapshots.StateObject
open StateRecord?
mergeRecords(
    previous: StateRecord,
    current: StateRecord,
    applied: StateRecord
)

Produce a merged state based on the conflicting state changes.

Cmn

Public constructors

SnapshotStateSet

<T : Any?> SnapshotStateSet()

Public functions

add

open fun add(element: T): Boolean

addAll

open fun addAll(elements: Collection<T>): Boolean

clear

open fun clear(): Unit

contains

open operator fun contains(element: T): Boolean

containsAll

open fun containsAll(elements: Collection<T>): Boolean

isEmpty

open fun isEmpty(): Boolean

iterator

open operator fun iterator(): MutableIterator<T>

prependStateRecord

open fun prependStateRecord(value: StateRecord): Unit

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

remove

open fun remove(element: T): Boolean

removeAll

open fun removeAll(elements: Collection<T>): Boolean

retainAll

open fun retainAll(elements: Collection<T>): Boolean

toSet

fun toSet(): Set<T>

Return a set containing all the elements of this set.

The set returned is immutable and returned will not change even if the content of the set is changed in the same snapshot. It also will be the same instance until the content is changed. It is not, however, guaranteed to be the same instance for the same set as adding and removing the same item from the this set might produce a different instance with the same content.

This operation is O(1) and does not involve a physically copying the set. It instead returns the underlying immutable set used internally to store the content of the set.

It is recommended to use toSet when returning the value of this set from androidx.compose.runtime.snapshotFlow.

toString

open fun toString(): String

Public properties

firstStateRecord

open val firstStateRecordStateRecord

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

size

open val sizeInt