| <html devsite="true"> |
| <head> |
| <title>ItemSnapshotList</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <h1>ItemSnapshotList</h1> |
| <p> |
| <pre>public final class ItemSnapshotList<T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></pre> |
| </p> |
| <hr> |
| <p>Snapshot of data being presented by a androidx.pagingAsyncPagingDataDiffer or a <code><a href="/reference/androidx/paging/PagingDataAdapter.html">PagingDataAdapter</a></code>.</p> |
| <h2>Summary</h2> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Public fields</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T></code></td> |
| <td> |
| <div><code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code></div> |
| <p>The presented data, excluding placeholders.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/paging/ItemSnapshotList.html#placeholdersAfter()">placeholdersAfter</a></code></div> |
| <p>Number of placeholders after the presented <code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code>, 0 if <code><a href="/reference/androidx/paging/PagingConfig.html#enablePlaceholders()">enablePlaceholders</a></code> is <code>false</code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>final int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/paging/ItemSnapshotList.html#placeholdersBefore()">placeholdersBefore</a></code></div> |
| <p>Number of placeholders before the presented <code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code>, 0 if <code><a href="/reference/androidx/paging/PagingConfig.html#enablePlaceholders()">enablePlaceholders</a></code> is <code>false</code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>int</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/paging/ItemSnapshotList.html#size()">size</a></code></div> |
| <p>Size of <code><a href="/reference/androidx/paging/ItemSnapshotList.html">ItemSnapshotList</a></code> including placeholders.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Public constructors</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td> |
| <div><code><T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/ItemSnapshotList.html#ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)">ItemSnapshotList</a>(<br> @<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 0) int placeholdersBefore,<br> @<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 0) int placeholdersAfter,<br> <a href="https://developer.android.com/reference/java/util/List.html">List</a><T> items<br>)</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>T</code></td> |
| <td> |
| <div><code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">get</a>(int index)</code></div> |
| <p>Returns the item at <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code>, where <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code> includes the position of placeholders.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive" id="inhmethods"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Inherited methods</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From class <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-collection/index.html">AbstractCollection</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody> |
| <tr> |
| <td width="40%"><code>boolean</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-collection/contains.html">contains</a>(T element)</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>boolean</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-collection/contains-all.html">containsAll</a>(<a href="https://developer.android.com/reference/java/util/Collection.html">Collection</a><T> elements)</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>boolean</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-collection/is-empty.html">isEmpty</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/lang/String.html">String</a></code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-collection/to-string.html">toString</a>()</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From class <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/index.html">AbstractList</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody> |
| <tr> |
| <td width="40%"><code>boolean</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/equals.html">equals</a>(<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a> other)</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>int</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/hash-code.html">hashCode</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>int</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/index-of.html">indexOf</a>(T element)</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/Iterator.html">Iterator</a><T></code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/iterator.html">iterator</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>int</code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/last-index-of.html">lastIndexOf</a>(T element)</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/ListIterator.html">ListIterator</a><T></code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/list-iterator.html">listIterator</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/ListIterator.html">ListIterator</a><T></code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/list-iterator.html">listIterator</a>(int index)</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><T></code></td> |
| <td> |
| <div><code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-abstract-list/sub-list.html">subList</a>(int fromIndex, int toIndex)</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From class <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html">Collection</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/stream/Stream.html">Stream</a><T></code></td> |
| <td> |
| <div><code><a href="https://developer.android.com/reference/java/util/Collection.html#parallelStream()">parallelStream</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/Spliterator.html">Spliterator</a><T></code></td> |
| <td> |
| <div><code><a href="https://developer.android.com/reference/java/util/Collection.html#spliterator()">spliterator</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/stream/Stream.html">Stream</a><T></code></td> |
| <td> |
| <div><code><a href="https://developer.android.com/reference/java/util/Collection.html#stream()">stream</a>()</code></div> |
| </td> |
| </tr> |
| <tr> |
| <td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T[]</code></td> |
| <td> |
| <div><code><T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <span><del><a href="https://developer.android.com/reference/java/util/Collection.html#toArray(java.util.function.IntFunction[kotlin.Array[TypeParam(bounds=[kotlin.Any])]])">toArray</a></del></span>(<a href="https://developer.android.com/reference/java/util/function/IntFunction.html">IntFunction</a><T[]> p0)</code></div> |
| <p><strong>This method is deprecated.</strong> This member is not fully supported by Kotlin compiler, so it may be absent or have different signature in next major version</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From class <a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/index.html">Iterable</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody> |
| <tr> |
| <td width="40%"><code>void</code></td> |
| <td> |
| <div><code><a href="https://developer.android.com/reference/java/lang/Iterable.html#forEach(java.util.function.Consumer[TypeParam(bounds=[kotlin.Any?])?])">forEach</a>(<a href="https://developer.android.com/reference/java/util/function/Consumer.html">Consumer</a><T> p0)</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <h2>Public fields</h2> |
| <div><a name="getItems()"></a><a name="setItems()"></a><a name="getItems--"></a><a name="setItems--"></a> |
| <h3 class="api-name" id="items()">items</h3> |
| <pre class="api-signature no-pretty-print">public final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a><@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T> <a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></pre> |
| <p>The presented data, excluding placeholders.</p> |
| </div> |
| <div><a name="getPlaceholdersAfter()"></a><a name="setPlaceholdersAfter()"></a><a name="getPlaceholdersAfter--"></a><a name="setPlaceholdersAfter--"></a> |
| <h3 class="api-name" id="placeholdersAfter()">placeholdersAfter</h3> |
| <pre class="api-signature no-pretty-print">public final int <a href="/reference/androidx/paging/ItemSnapshotList.html#placeholdersAfter()">placeholdersAfter</a></pre> |
| <p>Number of placeholders after the presented <code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code>, 0 if <code><a href="/reference/androidx/paging/PagingConfig.html#enablePlaceholders()">enablePlaceholders</a></code> is <code>false</code>.</p> |
| </div> |
| <div><a name="getPlaceholdersBefore()"></a><a name="setPlaceholdersBefore()"></a><a name="getPlaceholdersBefore--"></a><a name="setPlaceholdersBefore--"></a> |
| <h3 class="api-name" id="placeholdersBefore()">placeholdersBefore</h3> |
| <pre class="api-signature no-pretty-print">public final int <a href="/reference/androidx/paging/ItemSnapshotList.html#placeholdersBefore()">placeholdersBefore</a></pre> |
| <p>Number of placeholders before the presented <code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code>, 0 if <code><a href="/reference/androidx/paging/PagingConfig.html#enablePlaceholders()">enablePlaceholders</a></code> is <code>false</code>.</p> |
| </div> |
| <div><a name="getSize()"></a><a name="setSize()"></a><a name="getSize--"></a><a name="setSize--"></a> |
| <h3 class="api-name" id="size()">size</h3> |
| <pre class="api-signature no-pretty-print">public int <a href="/reference/androidx/paging/ItemSnapshotList.html#size()">size</a></pre> |
| <p>Size of <code><a href="/reference/androidx/paging/ItemSnapshotList.html">ItemSnapshotList</a></code> including placeholders.</p> |
| <p>To get the size excluding placeholders, use <code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/size.html">List.size</a></code> on <code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code> directly.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">See also</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code></td> |
| <td></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <h2>Public constructors</h2> |
| <div><a name="ItemSnapshotList(kotlin.Int, kotlin.Int, kotlin.collections.List)"></a><a name="ItemSnapshotList-kotlin.Int-kotlin.Int-kotlin.collections.List-"></a><a name="itemsnapshotlist"></a> |
| <h3 class="api-name" id="ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)">ItemSnapshotList</h3> |
| <pre class="api-signature no-pretty-print">public final <T extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/ItemSnapshotList.html#ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)">ItemSnapshotList</a>(<br> @<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 0) int placeholdersBefore,<br> @<a href="/reference/androidx/annotation/IntRange.html">IntRange</a>(from = 0) int placeholdersAfter,<br> <a href="https://developer.android.com/reference/java/util/List.html">List</a><T> items<br>)</pre> |
| </div> |
| <h2>Public methods</h2> |
| <div><a name="get-kotlin.Int-"></a><a name="get"></a> |
| <h3 class="api-name" id="get(kotlin.Int)">get</h3> |
| <pre class="api-signature no-pretty-print">public T <a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">get</a>(int index)</pre> |
| <p>Returns the item at <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code>, where <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code> includes the position of placeholders. If <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code> points to the position of a placeholder, <code>null</code> is returned.</p> |
| <p>To get the size using an index excluding placeholders, use <code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/size.html">List.size</a></code> on <code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code> directly.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Throws</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td width="40%"><code>kotlin.IndexOutOfBoundsException</code></td> |
| <td> |
| <p>if <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code>< 0 or <code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">index</a></code><code><a href="/reference/androidx/paging/ItemSnapshotList.html#size()">size</a></code>.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| </body> |
| </html> |