blob: f80392d9c5072cf486983e74fa3d2321fe9294ea [file] [log] [blame]
<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>
{% setvar page_path %}androidx/paging/ItemSnapshotList.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public final class ItemSnapshotList&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</pre>
</p>
<hr>
<p>Snapshot of data being presented by a <a href="[androidx.pagingAsyncPagingDataDiffer]">androidx.pagingAsyncPagingDataDiffer</a> 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><code>final <a href="/reference/java/util/List.html">List</a>&lt;T&gt;</code></td>
<td width="100%">
<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><code>final int</code></td>
<td width="100%">
<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><code>final int</code></td>
<td width="100%">
<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><code>int</code></td>
<td width="100%">
<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>&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/ItemSnapshotList.html#ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)">ItemSnapshotList</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/kotlin/ranges/IntRange.html">IntRange</a>&nbsp;int&nbsp;placeholdersBefore,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/kotlin/ranges/IntRange.html">IntRange</a>&nbsp;int&nbsp;placeholdersAfter,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/java/util/List.html">List</a>&lt;T&gt;&nbsp;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><code>T</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">get</a>(int&nbsp;index)</code></div>
<p>Returns the item at <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">index</a></code>, where <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">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="/reference/kotlin/collections/AbstractCollection.html">AbstractCollection</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractCollection.html#contains(kotlin.Any)">contains</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractCollection.html#containsAll(kotlin.collections.Collection)">containsAll</a>(<a href="/reference/java/util/Collection.html">Collection</a>&lt;T&gt;&nbsp;elements)</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractCollection.html#isEmpty()">isEmpty</a>()</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/lang/String.html">String</a></code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractCollection.html#toString()">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="/reference/kotlin/collections/AbstractList.html">AbstractList</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#equals(kotlin.Any)">equals</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&nbsp;other)</code></div>
</td>
</tr>
<tr>
<td><code>int</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#hashCode()">hashCode</a>()</code></div>
</td>
</tr>
<tr>
<td><code>int</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#indexOf(kotlin.Any)">indexOf</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/util/Iterator.html">Iterator</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#iterator()">iterator</a>()</code></div>
</td>
</tr>
<tr>
<td><code>int</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#lastIndexOf(kotlin.Any)">lastIndexOf</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/util/ListIterator.html">ListIterator</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#listIterator()">listIterator</a>()</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/util/ListIterator.html">ListIterator</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#listIterator(kotlin.Int)">listIterator</a>(int&nbsp;index)</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/util/List.html">List</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/AbstractList.html#subList(kotlin.Int,kotlin.Int)">subList</a>(int&nbsp;fromIndex,&nbsp;int&nbsp;toIndex)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
<tr>
<td><devsite-expandable><span class="expand-control">From class <a href="/reference/kotlin/collections/Iterable.html">Iterable</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/Iterable.html#forEach(java.util.function.Consumer)">forEach</a>(<a href="/reference/java/util/function/Consumer.html">Consumer</a>&lt;T&gt;&nbsp;p0)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
<tr>
<td><devsite-expandable><span class="expand-control">From class <a href="/reference/kotlin/collections/Collection.html">Collection</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code><a href="/reference/java/util/stream/Stream.html">Stream</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/Collection.html#parallelStream()">parallelStream</a>()</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/util/Spliterator.html">Spliterator</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/Collection.html#spliterator()">spliterator</a>()</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/java/util/stream/Stream.html">Stream</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/Collection.html#stream()">stream</a>()</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/Array.html">Array</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <span><del><a href="/reference/kotlin/collections/Collection.html#toArray(java.util.function.IntFunction)">toArray</a></del></span>(<a href="/reference/java/util/function/IntFunction.html">IntFunction</a>&lt;<a href="/reference/kotlin/Array.html">Array</a>&lt;T&gt;&gt;&nbsp;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>
</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&nbsp;final&nbsp;<a href="/reference/java/util/List.html">List</a>&lt;T&gt;&nbsp;<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&nbsp;final&nbsp;int&nbsp;<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&nbsp;final&nbsp;int&nbsp;<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&nbsp;int&nbsp;<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="/reference/kotlin/collections/List.html#size()">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><code><a href="/reference/androidx/paging/ItemSnapshotList.html#items()">items</a></code></td>
<td width="100%"></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>
<h3 class="api-name" id="ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)">ItemSnapshotList</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/ItemSnapshotList.html#ItemSnapshotList(kotlin.Int,kotlin.Int,kotlin.collections.List)">ItemSnapshotList</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/kotlin/ranges/IntRange.html">IntRange</a>&nbsp;int&nbsp;placeholdersBefore,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/kotlin/ranges/IntRange.html">IntRange</a>&nbsp;int&nbsp;placeholdersAfter,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/java/util/List.html">List</a>&lt;T&gt;&nbsp;items<br>)</pre>
</div>
<h2>Public methods</h2>
<div><a name="get-kotlin.Int-"></a>
<h3 class="api-name" id="get(kotlin.Int)">get</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;T&nbsp;<a href="/reference/androidx/paging/ItemSnapshotList.html#get(kotlin.Int)">get</a>(int&nbsp;index)</pre>
<p>Returns the item at <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">index</a></code>, where <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">index</a></code> includes the position of placeholders. If <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">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="/reference/kotlin/collections/List.html#size()">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><code>kotlin.IndexOutOfBoundsException</code></td>
<td width="100%">
<p>if <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">index</a></code> &lt; 0 or <code><a href="/reference/androidx/paging/ItemSnapshotList.html#index()">index</a></code><code><a href="/reference/androidx/paging/ItemSnapshotList.html#size()">size</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>