blob: 89414957b4dc335b660b6b0dd6d74c24297ef013 [file] [log] [blame]
<html devsite="true">
<head>
<title>PagingDataDiffer</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>PagingDataDiffer</h1>
{% setvar page_path %}androidx/paging/PagingDataDiffer.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public abstract class PagingDataDiffer&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;</pre>
</p>
<hr>
<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/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a>&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[FlowPreview])&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a>&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#dataRefreshFlow()">dataRefreshFlow</a></code></div>
<p><strong>This field is deprecated.</strong> dataRefreshFlow is now redundant with the information passed from loadStateFlow and getItemCount, and will be removed in a future alpha version</p>
</td>
</tr>
<tr>
<td><code>final @<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[FlowPreview])&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a>&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#loadStateFlow()">loadStateFlow</a></code></div>
<p>A hot <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code> of <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> that emits a snapshot whenever the loading state of the current <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> changes.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#size()">size</a></code></div>
</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="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PagingDataDiffer.html#PagingDataDiffer(androidx.paging.DifferCallback,kotlinx.coroutines.CoroutineDispatcher)">PagingDataDiffer</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/DifferCallback.html">DifferCallback</a>&nbsp;differCallback,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html">CoroutineDispatcher</a>&nbsp;mainDispatcher<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>final @<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a>&nbsp;void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/paging/PagingDataDiffer.html#addDataRefreshListener(kotlin.Function1)">addDataRefreshListener</a></del></span>(Function1&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</code></div>
<p><strong>This method is deprecated.</strong> dataRefreshListener is now redundant with the information passed from loadStateListener and getItemCount, and will be removed in a future alpha version</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#addLoadStateListener(kotlin.Function1)">addLoadStateListener</a>(Function1&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</code></div>
<p>Add a <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> listener to observe the loading state of the current <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#collectFrom(androidx.paging.PagingData)">collectFrom</a>(<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&nbsp;pagingData)</code></div>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#get(kotlin.Int)">get</a>(@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/-int-range/index.html">IntRange</a>&nbsp;int&nbsp;index)</code></div>
<p>Returns the presented item at the specified position, notifying Paging of the item access to trigger any loads necessary to fulfill <code><a href="/reference/androidx/paging/PagingConfig.html#prefetchDistance()">prefetchDistance</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#peek(kotlin.Int)">peek</a>(@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/-int-range/index.html">IntRange</a>&nbsp;int&nbsp;index)</code></div>
<p>Returns the presented item at the specified position, without notifying Paging of the item access that would normally trigger page loads.</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#postEvents()">postEvents</a>()</code></div>
</td>
</tr>
<tr>
<td><code>abstract @<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#presentNewList(androidx.paging.NullPaddedList,androidx.paging.NullPaddedList,androidx.paging.CombinedLoadStates,kotlin.Int)">presentNewList</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/NullPaddedList.html">NullPaddedList</a>&lt;T&gt;&nbsp;previousList,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/NullPaddedList.html">NullPaddedList</a>&lt;T&gt;&nbsp;newList,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>&nbsp;newCombinedLoadStates,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;lastAccessedIndex<br>)</code></div>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#refresh()">refresh</a>()</code></div>
<p>Refresh the data presented by this <code><a href="/reference/androidx/paging/PagingDataDiffer.html">PagingDataDiffer</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final @<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a>&nbsp;void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/paging/PagingDataDiffer.html#removeDataRefreshListener(kotlin.Function1)">removeDataRefreshListener</a></del></span>(Function1&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</code></div>
<p><strong>This method is deprecated.</strong> dataRefreshListener is now redundant with the information passed from loadStateListener and getItemCount, and will be removed in a future alpha version</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#removeLoadStateListener(kotlin.Function1)">removeLoadStateListener</a>(Function1&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</code></div>
<p>Remove a previously registered <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> listener.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#retry()">retry</a>()</code></div>
<p>Retry any failed load requests that would result in a <code><a href="/reference/androidx/paging/LoadState.Error.html">LoadState.Error</a></code> update to this <code><a href="/reference/androidx/paging/PagingDataDiffer.html">PagingDataDiffer</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/ItemSnapshotList.html">ItemSnapshotList</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingDataDiffer.html#snapshot()">snapshot</a>()</code></div>
<p>Returns a new <code><a href="/reference/androidx/paging/ItemSnapshotList.html">ItemSnapshotList</a></code> representing the currently presented items, including any placeholders if they are enabled.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public fields</h2>
<div><a name="getDataRefreshFlow()"></a><a name="setDataRefreshFlow()"></a><a name="getDataRefreshFlow--"></a><a name="setDataRefreshFlow--"></a>
<h3 class="api-name" id="dataRefreshFlow()">dataRefreshFlow</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a><br>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[FlowPreview])<br>public&nbsp;final&nbsp;@<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a>&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[FlowPreview])&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a>&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>&gt;&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#dataRefreshFlow()">dataRefreshFlow</a></pre>
<aside class="caution"><strong>This field is deprecated.</strong><br>dataRefreshFlow is now redundant with the information passed from loadStateFlow and getItemCount, and will be removed in a future alpha version</aside>
<p>A <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code> of <code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code> that is emitted when new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> generations are submitted and displayed. The <code><a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html">Boolean</a></code> that is emitted is <code>true</code> if the new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> is empty, <code>false</code> otherwise.</p>
</div>
<div><a name="getLoadStateFlow()"></a><a name="setLoadStateFlow()"></a><a name="getLoadStateFlow--"></a><a name="setLoadStateFlow--"></a>
<h3 class="api-name" id="loadStateFlow()">loadStateFlow</h3>
<pre class="api-signature no-pretty-print">@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[FlowPreview])<br>public&nbsp;final&nbsp;@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-opt-in/index.html">OptIn</a>(markerClass&nbsp;=&nbsp;[FlowPreview])&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a>&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>&gt;&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#loadStateFlow()">loadStateFlow</a></pre>
<p>A hot <code><a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html">Flow</a></code> of <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> that emits a snapshot whenever the loading state of the current <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> changes.</p>
<p>This flow is conflated, so it buffers the last update to <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> and immediately delivers the current load states on collection.</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;final&nbsp;int&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#size()">size</a></pre>
</div>
<h2>Public constructors</h2>
<div><a name="PagingDataDiffer(androidx.paging.DifferCallback, kotlinx.coroutines.CoroutineDispatcher)"></a><a name="PagingDataDiffer-androidx.paging.DifferCallback-kotlinx.coroutines.CoroutineDispatcher-"></a>
<h3 class="api-name" id="PagingDataDiffer(androidx.paging.DifferCallback,kotlinx.coroutines.CoroutineDispatcher)">PagingDataDiffer</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PagingDataDiffer.html#PagingDataDiffer(androidx.paging.DifferCallback,kotlinx.coroutines.CoroutineDispatcher)">PagingDataDiffer</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/DifferCallback.html">DifferCallback</a>&nbsp;differCallback,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html">CoroutineDispatcher</a>&nbsp;mainDispatcher<br>)</pre>
</div>
<h2>Public methods</h2>
<div><a name="addDataRefreshListener-kotlin.Function1-"></a>
<h3 class="api-name" id="addDataRefreshListener(kotlin.Function1)">addDataRefreshListener</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a>&nbsp;void&nbsp;<span><del><a href="/reference/androidx/paging/PagingDataDiffer.html#addDataRefreshListener(kotlin.Function1)">addDataRefreshListener</a></del></span>(Function1&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>dataRefreshListener is now redundant with the information passed from loadStateListener and getItemCount, and will be removed in a future alpha version</aside>
<p>Add a listener to observe new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> generations.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Function1&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener</code></td>
<td width="100%">
<p>called whenever a new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> is submitted and displayed. <code>true</code> is passed to the <code><a href="/reference/androidx/paging/PagingDataDiffer.html#listener()">listener</a></code> if the new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> is empty, <code>false</code> otherwise.</p>
</td>
</tr>
</tbody>
</table>
</div>
<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/PagingDataDiffer.html#removeDataRefreshListener(kotlin.Function1)">removeDataRefreshListener</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="addLoadStateListener-kotlin.Function1-"></a>
<h3 class="api-name" id="addLoadStateListener(kotlin.Function1)">addLoadStateListener</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#addLoadStateListener(kotlin.Function1)">addLoadStateListener</a>(Function1&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</pre>
<p>Add a <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> listener to observe the loading state of the current <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>.</p>
<p>As new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> generations are submitted and displayed, the listener will be notified to reflect the current <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Function1&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener</code></td>
<td width="100%">
<p><code><a href="/reference/androidx/paging/LoadStates.html">LoadStates</a></code> listener to receive updates.</p>
</td>
</tr>
</tbody>
</table>
</div>
<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/PagingDataDiffer.html#removeLoadStateListener(kotlin.Function1)">removeLoadStateListener</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="collectFrom-androidx.paging.PagingData-"></a>
<h3 class="api-name" id="collectFrom(androidx.paging.PagingData)">collectFrom</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#collectFrom(androidx.paging.PagingData)">collectFrom</a>(<a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;&nbsp;pagingData)</pre>
</div>
<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;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#get(kotlin.Int)">get</a>(@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/-int-range/index.html">IntRange</a>&nbsp;int&nbsp;index)</pre>
<p>Returns the presented item at the specified position, notifying Paging of the item access to trigger any loads necessary to fulfill <code><a href="/reference/androidx/paging/PagingConfig.html#prefetchDistance()">prefetchDistance</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T</code></td>
<td width="100%">
<p>The presented item at position <code><a href="/reference/androidx/paging/PagingDataDiffer.html#index()">index</a></code>, <code>null</code> if it is a placeholder.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/-int-range/index.html">IntRange</a>&nbsp;int&nbsp;index</code></td>
<td width="100%">
<p>Index of the presented item to return, including placeholders.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="peek-kotlin.Int-"></a>
<h3 class="api-name" id="peek(kotlin.Int)">peek</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#peek(kotlin.Int)">peek</a>(@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/-int-range/index.html">IntRange</a>&nbsp;int&nbsp;index)</pre>
<p>Returns the presented item at the specified position, without notifying Paging of the item access that would normally trigger page loads.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;T</code></td>
<td width="100%">
<p>The presented item at position <code><a href="/reference/androidx/paging/PagingDataDiffer.html#index()">index</a></code>, <code>null</code> if it is a placeholder</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.ranges/-int-range/index.html">IntRange</a>&nbsp;int&nbsp;index</code></td>
<td width="100%">
<p>Index of the presented item to return, including placeholders.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="postEvents--"></a>
<h3 class="api-name" id="postEvents()">postEvents</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#postEvents()">postEvents</a>()</pre>
</div>
<div><a name="presentNewList(androidx.paging.NullPaddedList, androidx.paging.NullPaddedList, androidx.paging.CombinedLoadStates, kotlin.Int)"></a><a name="presentNewList-androidx.paging.NullPaddedList-androidx.paging.NullPaddedList-androidx.paging.CombinedLoadStates-kotlin.Int-"></a>
<h3 class="api-name" id="presentNewList(androidx.paging.NullPaddedList,androidx.paging.NullPaddedList,androidx.paging.CombinedLoadStates,kotlin.Int)">presentNewList</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a><br>public&nbsp;abstract&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a>&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#presentNewList(androidx.paging.NullPaddedList,androidx.paging.NullPaddedList,androidx.paging.CombinedLoadStates,kotlin.Int)">presentNewList</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/NullPaddedList.html">NullPaddedList</a>&lt;T&gt;&nbsp;previousList,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/NullPaddedList.html">NullPaddedList</a>&lt;T&gt;&nbsp;newList,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>&nbsp;newCombinedLoadStates,<br>&nbsp;&nbsp;&nbsp;&nbsp;int&nbsp;lastAccessedIndex<br>)</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="https://developer.android.com/reference/java/lang/Integer.html">Integer</a></code></td>
<td width="100%">
<p>Transformed result of <code><a href="/reference/androidx/paging/PagingDataDiffer.html#lastAccessedIndex()">lastAccessedIndex</a></code> as an index of <code><a href="/reference/androidx/paging/PagingDataDiffer.html#newList()">newList</a></code> using the diff result between <code><a href="/reference/androidx/paging/PagingDataDiffer.html#previousList()">previousList</a></code> and <code><a href="/reference/androidx/paging/PagingDataDiffer.html#newList()">newList</a></code>. Null if <code><a href="/reference/androidx/paging/PagingDataDiffer.html#newList()">newList</a></code> or <code><a href="/reference/androidx/paging/PagingDataDiffer.html#previousList()">previousList</a></code> lists are empty, where it does not make sense to transform <code><a href="/reference/androidx/paging/PagingDataDiffer.html#lastAccessedIndex()">lastAccessedIndex</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="refresh--"></a>
<h3 class="api-name" id="refresh()">refresh</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#refresh()">refresh</a>()</pre>
<p>Refresh the data presented by this <code><a href="/reference/androidx/paging/PagingDataDiffer.html">PagingDataDiffer</a></code>.</p>
<p><code><a href="/reference/androidx/paging/PagingDataDiffer.html#refresh()">refresh</a></code> triggers the creation of a new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> with a new instance of <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> to represent an updated snapshot of the backing dataset. If a <code><a href="/reference/androidx/paging/RemoteMediator.html">RemoteMediator</a></code> is set, calling <code><a href="/reference/androidx/paging/PagingDataDiffer.html#refresh()">refresh</a></code> will also trigger a call to <code><a href="/reference/androidx/paging/RemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">RemoteMediator.load</a></code> with <code><a href="/reference/androidx/paging/LoadType.REFRESH.html">LoadType</a></code> to allow <code><a href="/reference/androidx/paging/RemoteMediator.html">RemoteMediator</a></code> to check for updates to the dataset backing <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>.</p>
<p>Note: This API is intended for UI-driven refresh signals, such as swipe-to-refresh. Invalidation due repository-layer signals, such as DB-updates, should instead use <code><a href="/reference/androidx/paging/PagingSource.html#invalidate()">PagingSource.invalidate</a></code>.</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/PagingSource.html#invalidate()">invalidate</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="removeDataRefreshListener-kotlin.Function1-"></a>
<h3 class="api-name" id="removeDataRefreshListener(kotlin.Function1)">removeDataRefreshListener</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a><br>public&nbsp;final&nbsp;@<a href="/reference/androidx/paging/ExperimentalPagingApi.html">ExperimentalPagingApi</a>&nbsp;void&nbsp;<span><del><a href="/reference/androidx/paging/PagingDataDiffer.html#removeDataRefreshListener(kotlin.Function1)">removeDataRefreshListener</a></del></span>(Function1&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>dataRefreshListener is now redundant with the information passed from loadStateListener and getItemCount, and will be removed in a future alpha version</aside>
<p>Remove a previously registered listener for new <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> generations.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Function1&lt;<a href="https://developer.android.com/reference/java/lang/Boolean.html">Boolean</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener</code></td>
<td width="100%">
<p>Previously registered listener.</p>
</td>
</tr>
</tbody>
</table>
</div>
<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/PagingDataDiffer.html#addDataRefreshListener(kotlin.Function1)">addDataRefreshListener</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="removeLoadStateListener-kotlin.Function1-"></a>
<h3 class="api-name" id="removeLoadStateListener(kotlin.Function1)">removeLoadStateListener</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#removeLoadStateListener(kotlin.Function1)">removeLoadStateListener</a>(Function1&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener)</pre>
<p>Remove a previously registered <code><a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a></code> listener.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Function1&lt;<a href="/reference/androidx/paging/CombinedLoadStates.html">CombinedLoadStates</a>,&nbsp;<a href="https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html">Unit</a>&gt;&nbsp;listener</code></td>
<td width="100%">
<p>Previously registered listener.</p>
</td>
</tr>
</tbody>
</table>
</div>
<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/PagingDataDiffer.html#addLoadStateListener(kotlin.Function1)">addLoadStateListener</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="retry--"></a>
<h3 class="api-name" id="retry()">retry</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#retry()">retry</a>()</pre>
<p>Retry any failed load requests that would result in a <code><a href="/reference/androidx/paging/LoadState.Error.html">LoadState.Error</a></code> update to this <code><a href="/reference/androidx/paging/PagingDataDiffer.html">PagingDataDiffer</a></code>.</p>
<p>Unlike <code><a href="/reference/androidx/paging/PagingDataDiffer.html#refresh()">refresh</a></code>, this does not invalidate <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>, it only retries failed loads within the same generation of <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>.</p>
<p><code><a href="/reference/androidx/paging/LoadState.Error.html">LoadState.Error</a></code> can be generated from two types of load requests:</p>
<ul>
<li>
<p><code><a href="/reference/androidx/paging/PagingSource.html#load(androidx.paging.PagingSource.LoadParams)">PagingSource.load</a></code> returning <code><a href="/reference/androidx/paging/PagingSource.LoadResult.Error.html">PagingSource.LoadResult.Error</a></code></p>
</li>
<li>
<p><code><a href="/reference/androidx/paging/RemoteMediator.html#load(androidx.paging.LoadType,androidx.paging.PagingState)">RemoteMediator.load</a></code> returning <code><a href="/reference/androidx/paging/RemoteMediator.MediatorResult.Error.html">RemoteMediator.MediatorResult.Error</a></code></p>
</li>
</ul>
</div>
<div><a name="snapshot--"></a>
<h3 class="api-name" id="snapshot()">snapshot</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="/reference/androidx/paging/ItemSnapshotList.html">ItemSnapshotList</a>&lt;T&gt;&nbsp;<a href="/reference/androidx/paging/PagingDataDiffer.html#snapshot()">snapshot</a>()</pre>
<p>Returns a new <code><a href="/reference/androidx/paging/ItemSnapshotList.html">ItemSnapshotList</a></code> representing the currently presented items, including any placeholders if they are enabled.</p>
</div>
</body>
</html>