Google is committed to advancing racial equity for Black communities. See how.

ModelList

class ModelList<T> : MutableList<T>, Framed
kotlin.Any
   ↳ androidx.compose.runtime.frames.ModelList

Summary

Public constructors

Public methods
Boolean
add(element: T)

Unit
add(index: Int, element: T)

Boolean
addAll(index: Int, elements: Collection<T>)

Boolean
addAll(elements: Collection<T>)

Unit

Boolean
contains(element: T)

Boolean
containsAll(elements: Collection<T>)

T
get(index: Int)

Int
indexOf(element: T)

Boolean

MutableIterator<T>

Int
lastIndexOf(element: T)

MutableListIterator<T>

MutableListIterator<T>
listIterator(index: Int)

Unit

Add a new state record to the beginning of a list.

Boolean
remove(element: T)

Boolean
removeAll(elements: Collection<T>)

T
removeAt(index: Int)

Boolean
retainAll(elements: Collection<T>)

T
set(index: Int, element: T)

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

Inherited extension functions
From androidx.compose.ui.gesture.kotlin.collections.List
Boolean
List<PointerInputChange>.anyPointersInBounds(bounds: IntSize)

Utility method that determines if any pointers are currently in bounds.

From androidx.wear.complications.data.kotlin.collections.Collection
IntArray

Converts an array of ComplicationType to an array of integers with the corresponding wire types.

From androidx.compose.ui.util.kotlin.collections.List
Boolean
List<T>.fastAll(predicate: (T) -> Boolean)

Returns true if all elements match the given predicate.

Boolean
List<T>.fastAny(predicate: (T) -> Boolean)

Returns true if at least one element matches the given predicate.

T?
List<T>.fastFirstOrNull(predicate: (T) -> Boolean)

Returns the first value that predicate returns true for or null if nothing matches.

Unit
List<T>.fastForEach(action: (T) -> Unit)

Iterates through a List using the index and calls action for each item.

Unit
List<T>.fastForEachIndexed(action: (Int, T) -> Unit)

Iterates through a List using the index and calls action for each item.

List<R>
List<T>.fastMap(transform: (T) -> R)

Returns a list containing the results of applying the given transform function to each element in the original collection.

C
List<T>.fastMapTo(destination: C, transform: (T) -> R)

Applies the given transform function to each element of the original collection and appends the results to the given destination.

T?
List<T>.fastMaxBy(selector: (T) -> R)

Returns the first element yielding the largest value of the given function or null if there are no elements.

Int
List<T>.fastSumBy(selector: (T) -> Int)

Returns the sum of all values produced by selector function applied to each element in the list.

From androidx.compose.runtime.kotlin.collections.Collection
SnapshotStateList<T>

Create an instance of MutableList from a collection that is observerable and can be snapshot.

From androidx.compose.runtime.kotlin.collections.Iterable
SnapshotStateMap<K, V>

Create an instance of MutableMap<K, V> from a collection of pairs that is observable and can be snapshot.

Properties
Record

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

Int

Public constructors

<init>

ModelList()

Public methods

add

fun add(element: T): Boolean

add

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

addAll

fun addAll(
    index: Int,
    elements: Collection<T>
): Boolean

addAll

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

clear

fun clear(): Unit

contains

fun contains(element: T): Boolean

containsAll

fun containsAll(elements: Collection<T>): Boolean

get

fun get(index: Int): T

indexOf

fun indexOf(element: T): Int

isEmpty

fun isEmpty(): Boolean

iterator

fun iterator(): MutableIterator<T>

lastIndexOf

fun lastIndexOf(element: T): Int

listIterator

fun listIterator(): MutableListIterator<T>

listIterator

fun listIterator(index: Int): MutableListIterator<T>

prependFrameRecord

fun prependFrameRecord(value: Record): Unit

Add a new state record to the beginning of a list. After this call firstFrameRecord should be value.

remove

fun remove(element: T): Boolean

removeAll

fun removeAll(elements: Collection<T>): Boolean

removeAt

fun removeAt(index: Int): T

retainAll

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

set

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

subList

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

Properties

firstFrameRecord

val firstFrameRecord: Record

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

size

val size: Int