SnapshotStateList


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.

Summary

Public constructors

Cmn
android

Public functions

open Boolean
add(element: T)
Cmn
android
open Unit
add(index: Int, element: T)
Cmn
android
open Boolean
addAll(elements: Collection<T>)
Cmn
android
open Boolean
addAll(index: Int, elements: Collection<T>)
Cmn
android
open Unit
Cmn
android
open operator Boolean
contains(element: T)
Cmn
android
open Boolean
containsAll(elements: Collection<T>)
Cmn
android
open Int
android
open operator T
get(index: Int)
Cmn
android
open Int
indexOf(element: T)
Cmn
android
open Boolean
Cmn
android
open operator MutableIterator<T>
Cmn
android
open Int
lastIndexOf(element: T)
Cmn
android
open MutableListIterator<T>
Cmn
android
open MutableListIterator<T>
listIterator(index: Int)
Cmn
android
open Unit

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 T
removeAt(index: Int)
Cmn
android
Unit
removeRange(fromIndex: Int, toIndex: Int)
Cmn
android
open Boolean
retainAll(elements: Collection<T>)
Cmn
android
open operator T
set(index: Int, element: T)
Cmn
android
open MutableList<T>
subList(fromIndex: Int, toIndex: Int)
Cmn
android
List<T>

Return a list containing all the elements of this list.

Cmn
android
open String
android
open String
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

From kotlin.collections.Collection
open Stream<T>
android
open Stream<T>
android
open Stream<T>
android
open Stream<T>
android
open Array<T>

This function is deprecated. This member is not fully supported by Kotlin compiler, so it may be absent or have different signature in next major version

android
open Array<T>

This function is deprecated. This member is not fully supported by Kotlin compiler, so it may be absent or have different signature in next major version

android
From kotlin.collections.Iterable
open Unit
android
open Unit
android
From kotlin.collections.List
From kotlin.collections.MutableCollection
open Boolean
android
open Boolean
android
From kotlin.collections.MutableList
open Unit
addFirst(p0: T)
android
open Unit
addFirst(p0: T)
android
open Unit
addLast(p0: T)
android
open Unit
addLast(p0: T)
android
open T
android
open T
android
open T
android
open T
android
open Unit
android
open Unit
android
open Unit
android
open Unit
android
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.

android
open StateRecord?
mergeRecords(
    previous: StateRecord,
    current: StateRecord,
    applied: StateRecord
)

Produce a merged state based on the conflicting state changes.

Cmn
open StateRecord?
mergeRecords(
    previous: StateRecord,
    current: StateRecord,
    applied: StateRecord
)

Produce a merged state based on the conflicting state changes.

android

Public constructors

SnapshotStateList

<T : Any?> SnapshotStateList()

Public functions

add

open fun add(element: T): Boolean

add

open fun add(index: Int, element: T): Unit

addAll

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

addAll

open fun addAll(index: Int, 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

describeContents

open fun describeContents(): Int

get

open operator fun get(index: Int): T

indexOf

open fun indexOf(element: T): Int

isEmpty

open fun isEmpty(): Boolean

iterator

open operator fun iterator(): MutableIterator<T>

lastIndexOf

open fun lastIndexOf(element: T): Int

listIterator

open fun listIterator(): MutableListIterator<T>

listIterator

open fun listIterator(index: Int): MutableListIterator<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

removeAt

open fun removeAt(index: Int): T

removeRange

fun removeRange(fromIndex: Int, toIndex: Int): Unit

retainAll

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

set

open operator fun set(index: Int, element: T): T

subList

open fun subList(fromIndex: Int, toIndex: Int): MutableList<T>

toList

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.

toString

open fun toString(): String

toString

open fun toString(): String

writeToParcel

open fun writeToParcel(parcel: Parcel, flags: Int): Unit

Public properties

firstStateRecord

open val firstStateRecordStateRecord

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

size

open val sizeInt