SnapshotStateList
public actual class SnapshotStateList<T>
internal actual constructor(persistentList: PersistentList<T>) :
StateObject, MutableList<T>, RandomAccess
An implementation of MutableList
that can be observed and snapshot. This is the result type
created by androidx.compose.runtime.mutableStateListOf
.
This class closely implements the same semantics as ArrayList
.
Secondary Constructors
public actual constructor() : this(persistentListOf())
Functions
public actual fun toList(): List<T>
Return a list containing all the elements of this list.
The list returned is immutable and returned will not change even if the content of the list 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 list as adding and removing the same item from the this list might produce a different instance with the same content.
This operation is O(1) and does not involve a physically copying the list. It instead returns the underlying immutable list used internally to store the content of the list.
It is recommended to use toList
when using returning the value of this list from
androidx.compose.runtime.snapshotFlow
.
public actual fun removeRange(fromIndex: Int, toIndex: Int)
public expect class SnapshotStateList<T> internal constructor(persistentList: PersistentList<T>) :
StateObject, MutableList<T>, RandomAccess
An implementation of MutableList
that can be observed and snapshot. This is the result type
created by androidx.compose.runtime.mutableStateListOf
.
This class closely implements the same semantics as ArrayList
.
Secondary Constructors
public constructor()
Functions
public fun toList(): List<T>
Return a list containing all the elements of this list.
The list returned is immutable and returned will not change even if the content of the list 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 list as adding and removing the same item from the this list might produce a different instance with the same content.
This operation is O(1) and does not involve a physically copying the list. It instead returns the underlying immutable list used internally to store the content of the list.
It is recommended to use toList
when using returning the value of this list from
androidx.compose.runtime.snapshotFlow
.
public fun removeRange(fromIndex: Int, toIndex: Int)
@SuppressLint("BanParcelableUsage")
public actual class SnapshotStateList<T>
internal actual constructor(persistentList: PersistentList<T>) :
Parcelable, StateObject, MutableList<T>, RandomAccess
An implementation of MutableList
that can be observed and snapshot. This is the result type
created by androidx.compose.runtime.mutableStateListOf
.
This class closely implements the same semantics as ArrayList
.
Secondary Constructors
public actual constructor() : this(persistentListOf())
Functions
public actual fun toList(): List<T>
Return a list containing all the elements of this list.
The list returned is immutable and returned will not change even if the content of the list 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 list as adding and removing the same item from the this list might produce a different instance with the same content.
This operation is O(1) and does not involve a physically copying the list. It instead returns the underlying immutable list used internally to store the content of the list.
It is recommended to use toList
when using returning the value of this list from
androidx.compose.runtime.snapshotFlow
.
public actual fun removeRange(fromIndex: Int, toIndex: Int)
Companion Object
Properties
@JvmField
val CREATOR: Parcelable.Creator<SnapshotStateList<Any?>>