# ItemSnapshotList

Artifact: [androidx.paging:paging-common](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/ItemSnapshotList.kt+class:androidx.paging.ItemSnapshotList) Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

*** ** * ** ***


```
public final class ItemSnapshotList<T extends Object> extends AbstractList<T>
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [kotlin.collections.AbstractCollection](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/index.html) |||
|   | ↳ | [kotlin.collections.AbstractList](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/index.html)\<T\> ||
|   |   | ↳ | [androidx.paging.ItemSnapshotList](https://developer.android.com/reference/androidx/paging/ItemSnapshotList) |

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/paging/ItemSnapshotList#ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)( @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int placeholdersBefore, @https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int placeholdersAfter, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> items )` |

| ### Public methods |
|---|---|
| `T` | `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)(int index)` Returns the item at `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)`, where `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)` includes the position of placeholders. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull T>` | `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#getItems()()` The presented data, excluding placeholders. |
| `final int` | `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#getPlaceholdersAfter()()` Number of placeholders after the presented `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#(kotlin.Int,kotlin.Int,kotlin.collections.List)`, 0 if `https://developer.android.com/reference/androidx/paging/PagingConfig#enablePlaceholders()` is `false`. |
| `final int` | `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#getPlaceholdersBefore()()` Number of placeholders before the presented `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#(kotlin.Int,kotlin.Int,kotlin.collections.List)`, 0 if `https://developer.android.com/reference/androidx/paging/PagingConfig#enablePlaceholders()` is `false`. |
| `int` | `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#getSize()()` Size of `https://developer.android.com/reference/androidx/paging/ItemSnapshotList` including placeholders. |

### Inherited methods

From [kotlin.collections.AbstractCollection](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/index.html) `boolean` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/contains.html(T element)` `boolean` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/contains-all.html(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<T> elements)` `boolean` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/is-empty.html()` `@https://developer.android.com/reference/androidx/annotation/NonNull Object[]` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/to-array.html()` `@https://developer.android.com/reference/androidx/annotation/NonNull T[]` `<T extends https://developer.android.com/reference/java/lang/Object.html> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/to-array.html(@https://developer.android.com/reference/androidx/annotation/NonNull T[] array)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-collection/to-string.html()` From [kotlin.collections.AbstractList](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/index.html) `boolean` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/equals.html(https://developer.android.com/reference/java/lang/Object.html other)` `int` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/hash-code.html()` `int` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/index-of.html(T element)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Iterator.html<T>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/iterator.html()` `int` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/last-index-of.html(T element)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/ListIterator.html<T>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/list-iterator.html()` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/ListIterator.html<T>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/list-iterator.html(int index)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<T>` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-abstract-list/sub-list.html(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](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public T get(int index)
```

Returns the item at `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)`, where `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)` includes the position of placeholders. If `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)` points to the position of a placeholder, `null` is returned.

To get the size using an index excluding placeholders, use `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/size.html` on `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#items()` directly.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-index-out-of-bounds-exception/index.html` | if `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)`\< 0 or `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#get(kotlin.Int)`\>`https://developer.android.com/reference/androidx/paging/ItemSnapshotList#size()`. |

### getItems

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

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

The presented data, excluding placeholders.

### getPlaceholdersAfter

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final int getPlaceholdersAfter()
```

Number of placeholders after the presented `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#(kotlin.Int,kotlin.Int,kotlin.collections.List)`, 0 if `https://developer.android.com/reference/androidx/paging/PagingConfig#enablePlaceholders()` is `false`.

### getPlaceholdersBefore

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final int getPlaceholdersBefore()
```

Number of placeholders before the presented `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#(kotlin.Int,kotlin.Int,kotlin.collections.List)`, 0 if `https://developer.android.com/reference/androidx/paging/PagingConfig#enablePlaceholders()` is `false`.

### getSize

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public int getSize()
```

Size of `https://developer.android.com/reference/androidx/paging/ItemSnapshotList` including placeholders.

To get the size excluding placeholders, use `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/size.html` on `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#items()` directly.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/ItemSnapshotList#items()` |   |