🌈 Create new beautiful Compose Gradients with our new wesite ->
Class

SnapshotStateList

Source set: Android
public class SnapshotStateList<T>
Source set: Common
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

Source set: Common
override var firstStateRecord: StateRecord

size

Source set: Common
override val size: Int

Functions

prependStateRecord

Source set: Common
override fun prependStateRecord(value: StateRecord)

toList

Source set: Common
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

Source set: Common
override fun contains(element: T): Boolean

containsAll

Source set: Common
override fun containsAll(elements: Collection<T>): Boolean

get

Source set: Common
override fun get(index: Int): T

indexOf

Source set: Common
override fun indexOf(element: T): Int

isEmpty

Source set: Common
override fun isEmpty(): Boolean

iterator

Source set: Common
override fun iterator(): MutableIterator<T>

lastIndexOf

Source set: Common
override fun lastIndexOf(element: T): Int

listIterator

Source set: Common
override fun listIterator(): MutableListIterator<T>

listIterator

Source set: Common
override fun listIterator(index: Int): MutableListIterator<T>

subList

Source set: Common
override fun subList(fromIndex: Int, toIndex: Int): MutableList<T>

add

Source set: Common
override fun add(element: T): Boolean

add

Source set: Common
override fun add(index: Int, element: T)

addAll

Source set: Common
override fun addAll(elements: Collection<T>): Boolean

addAll

Source set: Common
override fun addAll(index: Int, elements: Collection<T>): Boolean

clear

Source set: Common
override fun clear()

remove

Source set: Common
override fun remove(element: T): Boolean

removeAll

Source set: Common
override fun removeAll(elements: Collection<T>): Boolean

removeAt

Source set: Common
override fun removeAt(index: Int): T

retainAll

Source set: Common
override fun retainAll(elements: Collection<T>): Boolean

set

Source set: Common
override fun set(index: Int, element: T): T

removeRange

Source set: Common
public fun removeRange(fromIndex: Int, toIndex: Int)
Source set: NonAndroid
public class SnapshotStateList<T>