public class SnapshotStateList<T>
public 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.
Properties
firstStateRecord
override var firstStateRecord: StateRecord
size
override val size: Int
Functions
prependStateRecord
override fun prependStateRecord(value: StateRecord)
toList
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.
contains
override fun contains(element: T): Boolean
containsAll
override fun containsAll(elements: Collection<T>): Boolean
get
override fun get(index: Int): T
indexOf
override fun indexOf(element: T): Int
isEmpty
override fun isEmpty(): Boolean
iterator
override fun iterator(): MutableIterator<T>
lastIndexOf
override fun lastIndexOf(element: T): Int
listIterator
override fun listIterator(): MutableListIterator<T>
listIterator
override fun listIterator(index: Int): MutableListIterator<T>
subList
override fun subList(fromIndex: Int, toIndex: Int): MutableList<T>
add
override fun add(element: T): Boolean
add
override fun add(index: Int, element: T)
addAll
override fun addAll(elements: Collection<T>): Boolean
addAll
override fun addAll(index: Int, elements: Collection<T>): Boolean
clear
override fun clear()
remove
override fun remove(element: T): Boolean
removeAll
override fun removeAll(elements: Collection<T>): Boolean
removeAt
override fun removeAt(index: Int): T
retainAll
override fun retainAll(elements: Collection<T>): Boolean
set
override fun set(index: Int, element: T): T
removeRange
public fun removeRange(fromIndex: Int, toIndex: Int)
public class SnapshotStateList<T>