{% setvar book_path %}/reference/kotlin/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

ItemSnapshotList

{% setvar page_path %}androidx/paging/ItemSnapshotList.html{% endsetvar %} {% setvar can_switch %}1{% endsetvar %} {% include "reference/_kotlin_switcher2.md" %}

class ItemSnapshotList<T : Any?>


Snapshot of data being presented by a androidx.pagingAsyncPagingDataDiffer or a PagingDataAdapter.

Summary

Public properties

List<T>

The presented data, excluding placeholders.

Int

Number of placeholders after the presented items, 0 if enablePlaceholders is false.

Int

Number of placeholders before the presented items, 0 if enablePlaceholders is false.

open Int

Size of ItemSnapshotList including placeholders.

Public constructors

<T : Any?> ItemSnapshotList(
    @IntRange placeholdersBefore: Int,
    @IntRange placeholdersAfter: Int,
    items: List<T>
)

Public functions

open operator T?
get(index: Int)

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

Inherited functions

From class AbstractCollection
open operator Boolean
contains(element: T?)
open Boolean
containsAll(elements: Collection<T?>)
open Boolean
open String
From class AbstractList
open operator Boolean
equals(other: Any?)
open Int
open Int
indexOf(element: T?)
open operator Iterator<T?>
open Int
lastIndexOf(element: T?)
open ListIterator<T?>
open ListIterator<T?>
listIterator(index: Int)
open List<T?>
subList(fromIndex: Int, toIndex: Int)
From class Iterable
open Unit
forEach(p0: Consumer<T?>)
From class Collection
open Stream<T?>
open Spliterator<T?>
open Stream<T?>
open Array<T>
<T : Any> toArray(p0: IntFunction<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

Public properties

items

val itemsList<T>

The presented data, excluding placeholders.

placeholdersAfter

val placeholdersAfterInt

Number of placeholders after the presented items, 0 if enablePlaceholders is false.

placeholdersBefore

val placeholdersBeforeInt

Number of placeholders before the presented items, 0 if enablePlaceholders is false.

size

open val sizeInt

Size of ItemSnapshotList including placeholders.

To get the size excluding placeholders, use List.size on items directly.

See also
items

Public constructors

ItemSnapshotList

<T : Any?> ItemSnapshotList(
    @IntRange placeholdersBefore: Int,
    @IntRange placeholdersAfter: Int,
    items: List<T>
)

Public functions

get

open operator fun get(index: Int): T?

Returns the item at index, where index includes the position of placeholders. If index points to the position of a placeholder, null is returned.

To get the size using an index excluding placeholders, use List.size on items directly.

Throws
kotlin.IndexOutOfBoundsException

if index < 0 or indexsize.