{% setvar book_path %}/reference/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/_java_switcher2.md" %}

public final class ItemSnapshotList<T extends Object>


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

Summary

Public fields

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.

Public constructors

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

Public methods

@Nullable T
get(int index)

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

Inherited methods

From class AbstractCollection
boolean
contains(@Nullable T element)
boolean
boolean
@NonNull String
From class AbstractList
boolean
int
int
indexOf(@Nullable T element)
@NonNull Iterator<@NonNull T>
int
lastIndexOf(@Nullable T element)
@NonNull ListIterator<@NonNull T>
@NonNull ListIterator<@NonNull T>
listIterator(int index)
@NonNull List<@NonNull T>
subList(int fromIndex, int toIndex)
From class Iterable
void
From class Collection
@NonNull Stream<@NonNull T>
@NonNull Spliterator<@NonNull T>
@NonNull Stream<@NonNull T>
@NonNull Array<@NonNull T>
<T extends Object> toArray(@NonNull IntFunction<@NonNull Array<@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

Public fields

items

@NonNull
public final @NonNull List<@NonNull T> items

The presented data, excluding placeholders.

placeholdersAfter

@NonNull
public final int placeholdersAfter

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

placeholdersBefore

@NonNull
public final int placeholdersBefore

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

size

@NonNull
public int size

Size of ItemSnapshotList including placeholders.

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

See also
items

Public constructors

ItemSnapshotList

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

Public methods

get

@Nullable
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.

Throws
kotlin.IndexOutOfBoundsException

if index < 0 or indexsize.