Android Studio Sign in

ItemSnapshotList


public final class ItemSnapshotList<T extends Object> extends AbstractList


Snapshot of data being presented by a androidx.pagingAsyncPagingDataDiffer or a androidx.paging.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)

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

Added in 3.0.0
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

Added in 3.0.0
public final @NonNull List<@NonNull T> getItems()

The presented data, excluding placeholders.

getPlaceholdersAfter

Added in 3.0.0
public final int getPlaceholdersAfter()

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

getPlaceholdersBefore

Added in 3.0.0
public final int getPlaceholdersBefore()

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

getSize

Added in 3.0.0
public int getSize()

Size of ItemSnapshotList including placeholders.

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

See also
items
Morty Proxy This is a proxified and sanitized view of the page, visit original site.