SnapshotStateSet
-
Cmn
class SnapshotStateSet<T : Any?> : StateObject, MutableSet, RandomAccess
An implementation of MutableSet that can be observed and snapshot. This is the result type created by androidx.compose.runtime.mutableStateSetOf.
The returned set iteration order is in the order the items were inserted into the set.
| See also | |
|---|---|
mutableStateSetOf |
Summary
Public constructors |
|
|---|---|
<T : Any?> SnapshotStateSet() |
android
|
<T : Any?> SnapshotStateSet() |
Cmn
|
<T : Any?> SnapshotStateSet() |
android
|
Public functions |
||
|---|---|---|
open Boolean |
add(element: T) |
Cmn
android
|
open Boolean |
addAll(elements: Collection<T>) |
Cmn
android
|
open Unit |
clear() |
Cmn
android
|
open operator Boolean |
contains(element: T) |
Cmn
android
|
open Boolean |
containsAll(elements: Collection<T>) |
Cmn
android
|
open Int |
android
|
|
open Boolean |
isEmpty() |
Cmn
android
|
open operator MutableIterator<T> |
iterator() |
Cmn
android
|
open Unit |
prependStateRecord(value: StateRecord)Add a new state record to the beginning of a list. |
Cmn
android
|
open Boolean |
remove(element: T) |
Cmn
android
|
open Boolean |
removeAll(elements: Collection<T>) |
Cmn
android
|
open Boolean |
retainAll(elements: Collection<T>) |
Cmn
android
|
Set<T> |
toSet()Return a set containing all the elements of this set. |
Cmn
android
|
open String |
toString() |
android
|
open String |
toString() |
android
|
open Unit |
writeToParcel(parcel: Parcel, flags: Int) |
android
|
Public properties |
||
|---|---|---|
open StateRecord |
The first state record in a linked list of state records. |
Cmn
android
|
open Int |
Cmn
android
|
Inherited functions |
|||||||||
|---|---|---|---|---|---|---|---|---|---|
|
|||||||||
|
|||||||||
|
|||||||||
|
Public constructors
Public functions
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.
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.
Public properties
firstStateRecord
open val firstStateRecord: StateRecord
The first state record in a linked list of state records.