Android 12 Developer Preview is here! Try it out, and give us your feedback!

ItemSnapshotList

class ItemSnapshotList<T> : AbstractList<T?>
kotlin.Any
   ↳ kotlin.collections.AbstractCollection<E>
   ↳ kotlin.collections.AbstractList<T>
   ↳ androidx.paging.ItemSnapshotList

Snapshot of data being presented by a AsyncPagingDataDiffer or a PagingDataAdapter.

Summary

Public constructors
<init>(@IntRange(0) placeholdersBefore: Int, @IntRange(0) placeholdersAfter: Int, items: List<T>)

Snapshot of data being presented by a AsyncPagingDataDiffer or a PagingDataAdapter.

Public methods
T?
get(index: Int)

Returns the item at index, where index includes the position of placeholders.

Inherited extension functions
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>
Iterable<Pair<K, V>>.