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

ItemSnapshotList

public final class ItemSnapshotList<T extends Object> extends AbstractList

java.lang.Object
   ↳ kotlin.collections.AbstractCollection
     ↳ kotlin.collections.AbstractList
       ↳ androidx.paging.ItemSnapshotList

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

Summary

Public constructors

<T extends Object> ItemSnapshotList(
    @IntRange(from = 0) int placeholdersBefore,
    @IntRange(from = 0) int placeholdersAfter,
    @NonNull List<@NonNull T> items
)

Public methods

T
get(int index)

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

final @NonNull List<@NonNull T>

The presented data, excluding placeholders.

final int

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

final int

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

int

Size of ItemSnapshotList including placeholders.

Inherited methods

From kotlin.collections.AbstractCollection
boolean
contains(T element)
boolean
boolean
@NonNull Object[]
@NonNull T[]
<T extends Object> toArray(@NonNull T[] array)
@NonNull String
From kotlin.collections.AbstractList
boolean
equals(Object other)
int
int
indexOf(T element)
@NonNull Iterator<T>
int
lastIndexOf(T element)
@NonNull ListIterator<T>
@NonNull ListIterator<T>
listIterator(int index)
@NonNull List<T>
subList(int fromIndex, int toIndex)
From kotlin.collections.Collection
@NonNull Stream<T>
@NonNull Spliterator<T>
@NonNull Stream<T>
@NonNull T[]
<T extends Object> toArray(@NonNull IntFunction<@NonNull T[]> p0)

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

From kotlin.collections.Iterable
void

Public constructors

ItemSnapshotList

public <T extends Object> ItemSnapshotList(
    @IntRange(from = 0) int placeholdersBefore,
    @IntRange(from = 0) int placeholdersAfter,
    @NonNull List<@NonNull T> items
)

Public methods

get

public T get(int index)

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.

getItems

public final @NonNull List<@NonNull T> getItems()

The presented data, excluding placeholders.

getPlaceholdersAfter

public final int getPlaceholdersAfter()

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

getPlaceholdersBefore

public final int getPlaceholdersBefore()

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

getSize

public int getSize()

Size of ItemSnapshotList including placeholders.

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

See also
items