blob: dbfd46ad066699a9e01143fa05d4c136225ceb60 [file] [log] [blame]
<html devsite="true">
<head>
<title>PagedList</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>PagedList</h1>
{% setvar page_path %}androidx/paging/PagedList.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public abstract class PagedList&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</pre>
</p>
<div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known direct subclasses
<div class="showalways" id="subclasses-direct"><a href="/reference/androidx/paging/ContiguousPagedList.html">ContiguousPagedList</a></div>
</span>
<div id="subclasses-direct-summary">
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code><a href="/reference/androidx/paging/ContiguousPagedList.html">ContiguousPagedList</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
</devsite-expandable> </div>
<div class="devsite-table-wrapper"><devsite-expandable><span class="expand-control jd-sumtable-subclasses">Known indirect subclasses
<div class="showalways" id="subclasses-indirect"><a href="/reference/androidx/paging/InitialPagedList.html">InitialPagedList</a></div>
</span>
<div id="subclasses-indirect-summary">
<div class="devsite-table-wrapper">
<table class="responsive">
<tbody>
<tr>
<td><code><a href="/reference/androidx/paging/InitialPagedList.html">InitialPagedList</a></code></td>
<td width="100%">
<p>InitialPagedList is an empty placeholder that's sent at the front of a stream of <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</devsite-expandable> </div>
<hr>
<aside class="caution"><strong>This class is deprecated.</strong><br>PagedList is deprecated and has been replaced by PagingData</aside>
<p>Lazy loading list that pages in immutable content from a <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>.</p>
<p>A <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is a <code><a href="/reference/kotlin/collections/List.html">List</a></code> which loads its data in chunks (pages) from a <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>. Items can be accessed with <code><a href="/reference/androidx/paging/PagedList.html#get(kotlin.Int)">get</a></code>, and further loading can be triggered with <code><a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a></code>. To display a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>, see <code><a href="/reference/androidx/paging/PagedListAdapter.html">androidx.paging.PagedListAdapter</a></code>, which enables the binding of a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> to a <a href="[androidx.recyclerview.widget.RecyclerView]">androidx.recyclerview.widget.RecyclerView</a>.</p>
<h3> Loading Data</h3>
<p>All data in a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is loaded from its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>. Creating a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> loads the first chunk of data from the <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> immediately, and should for this reason be done on a background thread. The constructed <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> may then be passed to and used on the UI thread. This is done to prevent passing a list with no loaded content to the UI thread, which should generally not be presented to the user.</p>
<p>A <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> initially presents this first partial load as its content, and expands over time as content is loaded in. When <code><a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a></code> is called, items will be loaded in near the passed list index. If placeholder <code>null</code>s are present in the list, they will be replaced as content is loaded. If not, newly loaded items will be inserted at the beginning or end of the list.</p>
<p><code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> can present data for an unbounded, infinite scrolling list, or a very large but countable list. Use <code><a href="/reference/androidx/paging/PagedList.Config.html">PagedList.Config</a></code> to control how many items a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> loads, and when.</p>
<p>If you use <code><a href="/reference/androidx/paging/LivePagedListBuilder.html">androidx.paging.LivePagedListBuilder</a></code> to get a <a href="[androidx.lifecycle.LiveData]">androidx.lifecycle.LiveData</a>, it will initialize <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>s on a background thread for you.</p>
<h3> Placeholders</h3>
<p>There are two ways that <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> can represent its not-yet-loaded data - with or without <code>null</code> placeholders.</p>
<p>With placeholders, the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is always the full size of the data set. <code>get(N)</code> returns the <code>N</code>th item in the data set, or <code>null</code> if its not yet loaded.</p>
<p>Without <code>null</code> placeholders, the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is the sublist of data that has already been loaded. The size of the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is the number of currently loaded items, and <code>get(N)</code> returns the <code>N</code>th <em>loaded</em> item. This is not necessarily the <code>N</code>th item in the data set.</p>
<p>Placeholders have several benefits:</p>
<ul>
<li>
<p>They express the full sized list to the presentation layer (often a <code><a href="/reference/androidx/paging/PagedListAdapter.html">androidx.paging.PagedListAdapter</a></code>), and so can support scrollbars (without jumping as pages are loaded or dropped) and fast-scrolling to any position, loaded or not.</p>
</li>
<li>
<p>They avoid the need for a loading spinner at the end of the loaded list, since the list is always full sized.</p>
</li>
</ul>
<p>They also have drawbacks:</p>
<ul>
<li>
<p>Your Adapter needs to account for <code>null</code> items. This often means providing default values in data you bind to a <a href="[androidx.recyclerview.widget.RecyclerView.ViewHolder]">androidx.recyclerview.widget.RecyclerView.ViewHolder</a>.</p>
</li>
<li>
<p>They don't work well if your item views are of different sizes, as this will prevent loading items from cross-fading nicely.</p>
</li>
<li>
<p>They require you to count your data set, which can be expensive or impossible, depending on your <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>.</p>
</li>
</ul>
<p>Placeholders are enabled by default, but can be disabled in two ways. They are disabled if the <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> does not count its data set in its initial load, or if <code>false</code> is passed to <code><a href="/reference/androidx/paging/PagedList.Config.Builder.html#setEnablePlaceholders(kotlin.Boolean)">PagedList.Config.Builder.setEnablePlaceholders</a></code> when building a <code><a href="/reference/androidx/paging/PagedList.Config.html">PagedList.Config</a></code>.</p>
<h3> Mutability and Snapshots</h3>
<p>A <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is <em>mutable</em> while loading, or ready to load from its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>. As loads succeed, a mutable <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> will be updated via Runnables on the main thread. You can listen to these updates with a <code><a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a></code>. (Note that <code><a href="/reference/androidx/paging/PagedListAdapter.html">androidx.paging .PagedListAdapter</a></code> will listen to these to signal RecyclerView about the updates/changes).</p>
<p>If a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> attempts to load from an invalid <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>, it will <code><a href="/reference/androidx/paging/PagedList.html#detach()">detach</a></code> from the <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>, meaning that it will no longer attempt to load data. It will return true from <code><a href="/reference/androidx/paging/PagedList.html#isImmutable()">isImmutable</a></code>, and a new <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> / <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> pair must be created to load further data.</p>
<p>See <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> and <code><a href="/reference/androidx/paging/LivePagedListBuilder.html">androidx.paging.LivePagedListBuilder</a></code> for how new <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>s are created to represent changed data.</p>
<p>A <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> snapshot is simply an immutable shallow copy of the current state of the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> as a <code>List</code>. It will reference the same inner items, and contain the same <code>null</code> placeholders, if present.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</code></td>
<td width="100%">
<p>The type of the entries in the list.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.BoundaryCallback.html">PagedList.BoundaryCallback</a></code></td>
<td width="100%">
<p>Signals when a PagedList has reached the end of available data.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Builder.html">PagedList.Builder</a></code></td>
<td width="100%">
<p>Builder class for <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a></code></td>
<td width="100%">
<p>Callback signaling when content is loaded into the list.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Companion.html">PagedList.Companion</a></code></td>
<td width="100%"></td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Config.html">PagedList.Config</a></code></td>
<td width="100%">
<p>Configures how a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> loads content from its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Config.Builder.html">PagedList.Config.Builder</a></code></td>
<td width="100%">
<p>Builder class for <code><a href="/reference/androidx/paging/PagedList.Config.html">PagedList.Config</a></code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.LoadStateManager.html">PagedList.LoadStateManager</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
<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/PagedList.Config.html">PagedList.Config</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#config()">config</a></code></div>
<p>Return the Config used to construct this PagedList.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/DataSource.html">DataSource</a>&lt;?,&nbsp;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#dataSource()">dataSource</a></code></div>
<p><strong>This field is deprecated.</strong> DataSource is deprecated and has been replaced by PagingSource.</p>
</td>
</tr>
<tr>
<td><code>abstract boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#isDetached()">isDetached</a></code></div>
<p>True if the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> has detached the <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> it was loading from, and will no longer load new data.</p>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#isImmutable()">isImmutable</a></code></div>
<p>Returns whether the list is immutable.</p>
</td>
</tr>
<tr>
<td><code>abstract <a href="/reference/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#lastKey()">lastKey</a></code></div>
<p>Return the key for the position passed most recently to <code><a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#loadedCount()">loadedCount</a></code></div>
<p>Returns the number of items loaded in the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#modCount()">modCount</a></code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a>&lt;?,&nbsp;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#pagingSource()">pagingSource</a></code></div>
<p>The <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> that provides data to this <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#positionOffset()">positionOffset</a></code></div>
<p>Position offset of the data in the list.</p>
</td>
</tr>
<tr>
<td><code>int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#size()">size</a></code></div>
<p>Size of the list, including any placeholders (not-yet-loaded null padding).</p>
</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 void</code></td>
<td width="100%">
<div><code><span><del><a href="/reference/androidx/paging/PagedList.html#addWeakCallback(kotlin.collections.List,androidx.paging.PagedList.Callback)">addWeakCallback</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/java/util/List.html">List</a>&lt;T&gt;&nbsp;previousSnapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback<br>)</code></div>
<p><strong>This method is deprecated.</strong> Dispatching a diff since snapshot created is behavior that can be instead tracked by attaching a Callback to the PagedList that is mutating, and tracking changes since calling PagedList.snapshot().</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#addWeakCallback(androidx.paging.PagedList.Callback)">addWeakCallback</a>(<a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback)</code></div>
<p>Adds a callback.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#addWeakLoadStateListener(kotlin.Function2)">addWeakLoadStateListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;listener<br>)</code></div>
<p>Add a listener to observe the loading state of the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</td>
</tr>
<tr>
<td><code>abstract void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#detach()">detach</a>()</code></div>
<p>Detach the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> from its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>, and attempt to load no more data.</p>
</td>
</tr>
<tr>
<td><code>abstract void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#dispatchCurrentLoadState(kotlin.Function2)">dispatchCurrentLoadState</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;callback<br>)</code></div>
</td>
</tr>
<tr>
<td><code>T</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#get(kotlin.Int)">get</a>(int&nbsp;index)</code></div>
<p>Get the item in the list of loaded items at the provided index.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/NullPaddedList.html">NullPaddedList</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#getNullPaddedList()">getNullPaddedList</a>()</code></div>
</td>
</tr>
<tr>
<td><code>final int</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#lastLoad()">lastLoad</a>()</code></div>
<p>Last access location in list.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a>(int&nbsp;index)</code></div>
<p>Load adjacent items to passed index.</p>
</td>
</tr>
<tr>
<td><code>abstract void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#loadAroundInternal(kotlin.Int)">loadAroundInternal</a>(int&nbsp;index)</code></div>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#notifyChanged(kotlin.Int,kotlin.Int)">notifyChanged</a>(int&nbsp;position,&nbsp;int&nbsp;count)</code></div>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#notifyRemoved(kotlin.Int,kotlin.Int)">notifyRemoved</a>(int&nbsp;position,&nbsp;int&nbsp;count)</code></div>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#removeWeakCallback(androidx.paging.PagedList.Callback)">removeWeakCallback</a>(<a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback)</code></div>
<p>Removes a previously added callback.</p>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#removeWeakLoadStateListener(kotlin.Function2)">removeWeakLoadStateListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;listener<br>)</code></div>
<p>Remove a previously registered load state listener.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#retry()">retry</a>()</code></div>
<p>Retry any errors associated with this <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#setInitialLoadState(androidx.paging.LoadType,androidx.paging.LoadState)">setInitialLoadState</a>(<a href="/reference/androidx/paging/LoadType.html">LoadType</a>&nbsp;loadType,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>&nbsp;loadState)</code></div>
</td>
</tr>
<tr>
<td><code>final void</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagedList.html#setRetryCallback(java.lang.Runnable)">setRetryCallback</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/java/lang/Runnable.html">Runnable</a>&nbsp;refreshRetryCallback)</code></div>
</td>
</tr>
<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/PagedList.html#snapshot()">snapshot</a>()</code></div>
<p>Returns an immutable snapshot of the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> in its current state.</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/java/util/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/java/util/AbstractList.html#add(kotlin.Any)">add</a>(T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#add(kotlin.Int,kotlin.Any)">add</a>(int&nbsp;index,&nbsp;T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#addAll(kotlin.Int,kotlin.collections.Collection)">addAll</a>(int&nbsp;index,&nbsp;<a href="/reference/java/util/Collection.html">Collection</a>&lt;T&gt;&nbsp;elements)</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#clear()">clear</a>()</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/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/java/util/AbstractList.html#hashCode()">hashCode</a>()</code></div>
</td>
</tr>
<tr>
<td><code>int</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#indexOf(kotlin.Any)">indexOf</a>(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/java/util/AbstractList.html#iterator()">iterator</a>()</code></div>
</td>
</tr>
<tr>
<td><code>int</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#lastIndexOf(kotlin.Any)">lastIndexOf</a>(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/java/util/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/java/util/AbstractList.html#listIterator(kotlin.Int)">listIterator</a>(int&nbsp;index)</code></div>
</td>
</tr>
<tr>
<td><code>T</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#removeAt(kotlin.Int)">removeAt</a>(int&nbsp;p0)</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#removeRange(kotlin.Int,kotlin.Int)">removeRange</a>(int&nbsp;p0,&nbsp;int&nbsp;p1)</code></div>
</td>
</tr>
<tr>
<td><code>T</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractList.html#set(kotlin.Int,kotlin.Any)">set</a>(int&nbsp;index,&nbsp;T&nbsp;element)</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/java/util/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/java/util/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/java/util/AbstractCollection.html#addAll(kotlin.collections.Collection)">addAll</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/java/util/AbstractCollection.html#contains(kotlin.Any)">contains</a>(T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/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/java/util/AbstractCollection.html#isEmpty()">isEmpty</a>()</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractCollection.html#remove(kotlin.Any)">remove</a>(T&nbsp;element)</code></div>
</td>
</tr>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractCollection.html#removeAll(kotlin.collections.Collection)">removeAll</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/java/util/AbstractCollection.html#retainAll(kotlin.collections.Collection)">retainAll</a>(<a href="/reference/java/util/Collection.html">Collection</a>&lt;T&gt;&nbsp;elements)</code></div>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/Array.html">Array</a>&lt;<a href="/reference/java/lang/Object.html">Object</a>&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/java/util/AbstractCollection.html#toArray()">toArray</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; <a href="/reference/java/util/AbstractCollection.html#toArray(kotlin.Array)">toArray</a>(<a href="/reference/kotlin/Array.html">Array</a>&lt;T&gt;&nbsp;p0)</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/java/util/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/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>
<tr>
<td><devsite-expandable><span class="expand-control">From class <a href="/reference/kotlin/collections/MutableCollection.html">MutableCollection</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/MutableCollection.html#removeIf(java.util.function.Predicate)">removeIf</a>(<a href="/reference/java/util/function/Predicate.html">Predicate</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/MutableList.html">MutableList</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/MutableList.html#replaceAll(java.util.function.UnaryOperator)">replaceAll</a>(<a href="/reference/java/util/function/UnaryOperator.html">UnaryOperator</a>&lt;T&gt;&nbsp;p0)</code></div>
</td>
</tr>
<tr>
<td><code>void</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/collections/MutableList.html#sort(java.util.Comparator)">sort</a>(<a href="/reference/java/util/Comparator.html">Comparator</a>&lt;T&gt;&nbsp;p0)</code></div>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
</tbody>
</table>
</div>
<h2>Public fields</h2>
<div><a name="getConfig()"></a><a name="setConfig()"></a><a name="getConfig--"></a><a name="setConfig--"></a>
<h3 class="api-name" id="config()">config</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="/reference/androidx/paging/PagedList.Config.html">PagedList.Config</a>&nbsp;<a href="/reference/androidx/paging/PagedList.html#config()">config</a></pre>
<p>Return the Config used to construct this PagedList.</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/paging/PagedList.Config.html">PagedList.Config</a></code></td>
<td width="100%">
<p>the Config of this PagedList</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getDataSource()"></a><a name="setDataSource()"></a><a name="getDataSource--"></a><a name="setDataSource--"></a>
<h3 class="api-name" id="dataSource()">dataSource</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;<a href="/reference/androidx/paging/DataSource.html">DataSource</a>&lt;?,&nbsp;T&gt;&nbsp;<a href="/reference/androidx/paging/PagedList.html#dataSource()">dataSource</a></pre>
<aside class="caution"><strong>This field is deprecated.</strong><br>DataSource is deprecated and has been replaced by PagingSource. PagedList offers indirect ways of controlling fetch ('loadAround()', 'retry()') so that you should not need to access the DataSource/PagingSource.</aside>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Throws</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>kotlin.IllegalStateException</code></td>
<td width="100%">
<p>if this <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> was instantiated without a wrapping a backing <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code></p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getIsDetached()"></a><a name="setIsDetached()"></a><a name="getIsDetached--"></a><a name="setIsDetached--"></a>
<h3 class="api-name" id="isDetached()">isDetached</h3>
<pre class="api-signature no-pretty-print">public&nbsp;abstract&nbsp;boolean&nbsp;<a href="/reference/androidx/paging/PagedList.html#isDetached()">isDetached</a></pre>
<p>True if the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> has detached the <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> it was loading from, and will no longer load new data.</p>
<p>A detached list is <code><a href="/reference/androidx/paging/PagedList.html#isImmutable()">immutable</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p><code>true</code> if the data source is detached.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getIsImmutable()"></a><a name="setIsImmutable()"></a><a name="getIsImmutable--"></a><a name="setIsImmutable--"></a>
<h3 class="api-name" id="isImmutable()">isImmutable</h3>
<pre class="api-signature no-pretty-print">public&nbsp;boolean&nbsp;<a href="/reference/androidx/paging/PagedList.html#isImmutable()">isImmutable</a></pre>
<p>Returns whether the list is immutable.</p>
<p>Immutable lists may not become mutable again, and may safely be accessed from any thread.</p>
<p>In the future, this method may return true when a PagedList has completed loading from its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>. Currently, it is equivalent to <code><a href="/reference/androidx/paging/PagedList.html#isDetached()">isDetached</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>boolean</code></td>
<td width="100%">
<p><code>true</code> if the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> is immutable.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getLastKey()"></a><a name="setLastKey()"></a><a name="getLastKey--"></a><a name="setLastKey--"></a>
<h3 class="api-name" id="lastKey()">lastKey</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/java/lang/Object.html">Object</a>&nbsp;<a href="/reference/androidx/paging/PagedList.html#lastKey()">lastKey</a></pre>
<p>Return the key for the position passed most recently to <code><a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a></code>.</p>
<p>When a PagedList is invalidated, you can pass the key returned by this function to initialize the next PagedList. This ensures (depending on load times) that the next PagedList that arrives will have data that overlaps. If you use androidx.paging.LivePagedListBuilder, it will do this for you.</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/java/lang/Object.html">Object</a></code></td>
<td width="100%">
<p>Key of position most recently passed to <code><a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getLoadedCount()"></a><a name="setLoadedCount()"></a><a name="getLoadedCount--"></a><a name="setLoadedCount--"></a>
<h3 class="api-name" id="loadedCount()">loadedCount</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/paging/PagedList.html#loadedCount()">loadedCount</a></pre>
<p>Returns the number of items loaded in the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
<p>Unlike <code><a href="/reference/androidx/paging/PagedList.html#size()">size</a></code> this counts only loaded items, not placeholders.</p>
<p>If placeholders are <code><a href="/reference/androidx/paging/PagedList.Config.html#enablePlaceholders()">disabled</a></code>, this method is equivalent to <code><a href="/reference/androidx/paging/PagedList.html#size()">size</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int</code></td>
<td width="100%">
<p>Number of items currently loaded, not counting placeholders.</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/PagedList.html#size()">size</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getModCount()"></a><a name="setModCount()"></a><a name="getModCount--"></a><a name="setModCount--"></a>
<h3 class="api-name" id="modCount()">modCount</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/paging/PagedList.html#modCount()">modCount</a></pre>
</div>
<div><a name="getPagingSource()"></a><a name="setPagingSource()"></a><a name="getPagingSource--"></a><a name="setPagingSource--"></a>
<h3 class="api-name" id="pagingSource()">pagingSource</h3>
<pre class="api-signature no-pretty-print">public&nbsp;<a href="/reference/androidx/paging/PagingSource.html">PagingSource</a>&lt;?,&nbsp;T&gt;&nbsp;<a href="/reference/androidx/paging/PagedList.html#pagingSource()">pagingSource</a></pre>
<p>The <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> that provides data to this <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
</div>
<div><a name="getPositionOffset()"></a><a name="setPositionOffset()"></a><a name="getPositionOffset--"></a><a name="setPositionOffset--"></a>
<h3 class="api-name" id="positionOffset()">positionOffset</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/paging/PagedList.html#positionOffset()">positionOffset</a></pre>
<p>Position offset of the data in the list.</p>
<p>If the PagingSource backing this PagedList is counted, the item returned from <code>get(i)</code> has a position in the original data set of <code>i + getPositionOffset()</code>.</p>
<p>If placeholders are enabled, this value is always <code>0</code>, since <code>get(i)</code> will return either the data in its original index, or null if it is not loaded.</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/PagedList.html#size()">size</a></pre>
<p>Size of the list, including any placeholders (not-yet-loaded null padding).</p>
<p>To get the number of loaded items, not counting placeholders, use <code><a href="/reference/androidx/paging/PagedList.html#loadedCount()">loadedCount</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/PagedList.html#loadedCount()">loadedCount</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<h2>Public methods</h2>
<div><a name="addWeakCallback(kotlin.collections.List, androidx.paging.PagedList.Callback)"></a><a name="addWeakCallback-kotlin.collections.List-androidx.paging.PagedList.Callback-"></a>
<h3 class="api-name" id="addWeakCallback(kotlin.collections.List,androidx.paging.PagedList.Callback)">addWeakCallback</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<span><del><a href="/reference/androidx/paging/PagedList.html#addWeakCallback(kotlin.collections.List,androidx.paging.PagedList.Callback)">addWeakCallback</a></del></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/java/util/List.html">List</a>&lt;T&gt;&nbsp;previousSnapshot,<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback<br>)</pre>
<aside class="caution"><strong>This method is deprecated.</strong><br>Dispatching a diff since snapshot created is behavior that can be instead tracked by attaching a Callback to the PagedList that is mutating, and tracking changes since calling PagedList.snapshot().</aside>
<p>Adds a callback, and issues updates since the <code><a href="/reference/androidx/paging/PagedList.html#previousSnapshot()">previousSnapshot</a></code> was created.</p>
<p>If <code><a href="/reference/androidx/paging/PagedList.html#previousSnapshot()">previousSnapshot</a></code> is passed, the <code><a href="/reference/androidx/paging/PagedList.html#callback()">callback</a></code> will also immediately be dispatched any differences between the previous snapshot, and the current state. For example, if the previousSnapshot was of 5 nulls, 10 items, 5 nulls, and the current state was 5 nulls, 12 items, 3 nulls, the callback would immediately receive a call of<code>onChanged(14, 2)</code>.</p>
<p>This allows an observer that's currently presenting a snapshot to catch up to the most recent version, including any changes that may have been made.</p>
<p>The callback is internally held as weak reference, so <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> doesn't hold a strong reference to its observer, such as a <code><a href="/reference/androidx/paging/PagedListAdapter.html">PagedListAdapter</a></code>. If an adapter were held with a strong reference, it would be necessary to clear its <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> observer before it could be GC'd.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/java/util/List.html">List</a>&lt;T&gt;&nbsp;previousSnapshot</code></td>
<td width="100%">
<p>Snapshot previously captured from this List, or <code>null</code>.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback</code></td>
<td width="100%">
<p><code><a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a></code> to dispatch to.</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/PagedList.html#removeWeakCallback(androidx.paging.PagedList.Callback)">removeWeakCallback</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="addWeakCallback-androidx.paging.PagedList.Callback-"></a>
<h3 class="api-name" id="addWeakCallback(androidx.paging.PagedList.Callback)">addWeakCallback</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#addWeakCallback(androidx.paging.PagedList.Callback)">addWeakCallback</a>(<a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback)</pre>
<p>Adds a callback.</p>
<p>The callback is internally held as weak reference, so <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> doesn't hold a strong reference to its observer, such as a <code><a href="/reference/androidx/paging/PagedListAdapter.html">androidx.paging.PagedListAdapter</a></code>. If an adapter were held with a strong reference, it would be necessary to clear its <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> observer before it could be GC'd.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback</code></td>
<td width="100%">
<p>Callback to dispatch to.</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/PagedList.html#removeWeakCallback(androidx.paging.PagedList.Callback)">removeWeakCallback</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="addWeakLoadStateListener-kotlin.Function2-"></a>
<h3 class="api-name" id="addWeakLoadStateListener(kotlin.Function2)">addWeakLoadStateListener</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#addWeakLoadStateListener(kotlin.Function2)">addWeakLoadStateListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;listener<br>)</pre>
<p>Add a listener to observe the loading state of the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;listener</code></td>
<td width="100%">
<p>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/PagedList.html#removeWeakLoadStateListener(kotlin.Function2)">removeWeakLoadStateListener</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="detach--"></a>
<h3 class="api-name" id="detach()">detach</h3>
<pre class="api-signature no-pretty-print">public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#detach()">detach</a>()</pre>
<p>Detach the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> from its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code>, and attempt to load no more data.</p>
<p>This is called automatically when a <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> is observed to be invalid, which is a signal to stop loading. The <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> will continue to present existing data, but will not initiate new loads.</p>
</div>
<div><a name="dispatchCurrentLoadState-kotlin.Function2-"></a>
<h3 class="api-name" id="dispatchCurrentLoadState(kotlin.Function2)">dispatchCurrentLoadState</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#dispatchCurrentLoadState(kotlin.Function2)">dispatchCurrentLoadState</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;callback<br>)</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;T&nbsp;<a href="/reference/androidx/paging/PagedList.html#get(kotlin.Int)">get</a>(int&nbsp;index)</pre>
<p>Get the item in the list of loaded items at the provided index.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Returns</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>T</code></td>
<td width="100%">
<p>The item at the passed index, or <code>null</code> if a <code>null</code> placeholder is at the specified position.</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>int&nbsp;index</code></td>
<td width="100%">
<p>Index in the loaded item list. Must be &gt;= 0, and &lt; <code><a href="/reference/androidx/paging/PagedList.html#size()">size</a></code></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/PagedList.html#size()">size</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="getNullPaddedList--"></a>
<h3 class="api-name" id="getNullPaddedList()">getNullPaddedList</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;final&nbsp;<a href="/reference/androidx/paging/NullPaddedList.html">NullPaddedList</a>&lt;T&gt;&nbsp;<a href="/reference/androidx/paging/PagedList.html#getNullPaddedList()">getNullPaddedList</a>()</pre>
</div>
<div><a name="lastLoad--"></a>
<h3 class="api-name" id="lastLoad()">lastLoad</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;final&nbsp;int&nbsp;<a href="/reference/androidx/paging/PagedList.html#lastLoad()">lastLoad</a>()</pre>
<p>Last access location in list.</p>
<p>Used by list diffing to re-initialize loading near viewport.</p>
</div>
<div><a name="loadAround-kotlin.Int-"></a>
<h3 class="api-name" id="loadAround(kotlin.Int)">loadAround</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#loadAround(kotlin.Int)">loadAround</a>(int&nbsp;index)</pre>
<p>Load adjacent items to passed index.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>int&nbsp;index</code></td>
<td width="100%">
<p>Index at which to load.</p>
</td>
</tr>
</tbody>
</table>
</div>
<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 index is not within bounds.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="loadAroundInternal-kotlin.Int-"></a>
<h3 class="api-name" id="loadAroundInternal(kotlin.Int)">loadAroundInternal</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#loadAroundInternal(kotlin.Int)">loadAroundInternal</a>(int&nbsp;index)</pre>
</div>
<div><a name="notifyChanged(kotlin.Int, kotlin.Int)"></a><a name="notifyChanged-kotlin.Int-kotlin.Int-"></a>
<h3 class="api-name" id="notifyChanged(kotlin.Int,kotlin.Int)">notifyChanged</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#notifyChanged(kotlin.Int,kotlin.Int)">notifyChanged</a>(int&nbsp;position,&nbsp;int&nbsp;count)</pre>
</div>
<div><a name="notifyRemoved(kotlin.Int, kotlin.Int)"></a><a name="notifyRemoved-kotlin.Int-kotlin.Int-"></a>
<h3 class="api-name" id="notifyRemoved(kotlin.Int,kotlin.Int)">notifyRemoved</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#notifyRemoved(kotlin.Int,kotlin.Int)">notifyRemoved</a>(int&nbsp;position,&nbsp;int&nbsp;count)</pre>
</div>
<div><a name="removeWeakCallback-androidx.paging.PagedList.Callback-"></a>
<h3 class="api-name" id="removeWeakCallback(androidx.paging.PagedList.Callback)">removeWeakCallback</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#removeWeakCallback(androidx.paging.PagedList.Callback)">removeWeakCallback</a>(<a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback)</pre>
<p>Removes a previously added callback.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.Callback.html">PagedList.Callback</a>&nbsp;callback</code></td>
<td width="100%">
<p>Callback, previously added.</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/PagedList.html#addWeakCallback(kotlin.collections.List,androidx.paging.PagedList.Callback)">addWeakCallback</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="removeWeakLoadStateListener-kotlin.Function2-"></a>
<h3 class="api-name" id="removeWeakLoadStateListener(kotlin.Function2)">removeWeakLoadStateListener</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#removeWeakLoadStateListener(kotlin.Function2)">removeWeakLoadStateListener</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.html">Unit</a>&gt;&nbsp;listener<br>)</pre>
<p>Remove a previously registered load state listener.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<thead>
<tr>
<th colspan="2">Parameters</th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/jvm/functions/Function2.html">Function2</a>&lt;<a href="/reference/androidx/paging/LoadType.html">LoadType</a>,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>,&nbsp;<a href="/reference/kotlin/Unit.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/PagedList.html#addWeakLoadStateListener(kotlin.Function2)">addWeakLoadStateListener</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;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#retry()">retry</a>()</pre>
<p>Retry any errors associated with this <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
<p>If for example a network <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> append timed out, calling this method will retry the failed append load.</p>
<p>You can observe loading state via <code><a href="/reference/androidx/paging/PagedList.html#addWeakLoadStateListener(kotlin.Function2)">addWeakLoadStateListener</a></code>, though generally this is done through the <code><a href="/reference/androidx/paging/PagedListAdapter.html">PagedListAdapter</a></code> or <code><a href="/reference/androidx/paging/AsyncPagedListDiffer.html">AsyncPagedListDiffer</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/PagedList.html#addWeakLoadStateListener(kotlin.Function2)">addWeakLoadStateListener</a></code></td>
<td width="100%"></td>
</tr>
<tr>
<td><code><a href="/reference/androidx/paging/PagedList.html#removeWeakLoadStateListener(kotlin.Function2)">removeWeakLoadStateListener</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="setInitialLoadState(androidx.paging.LoadType, androidx.paging.LoadState)"></a><a name="setInitialLoadState-androidx.paging.LoadType-androidx.paging.LoadState-"></a>
<h3 class="api-name" id="setInitialLoadState(androidx.paging.LoadType,androidx.paging.LoadState)">setInitialLoadState</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#setInitialLoadState(androidx.paging.LoadType,androidx.paging.LoadState)">setInitialLoadState</a>(<a href="/reference/androidx/paging/LoadType.html">LoadType</a>&nbsp;loadType,&nbsp;<a href="/reference/androidx/paging/LoadState.html">LoadState</a>&nbsp;loadState)</pre>
</div>
<div><a name="setRetryCallback-java.lang.Runnable-"></a>
<h3 class="api-name" id="setRetryCallback(java.lang.Runnable)">setRetryCallback</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>public&nbsp;final&nbsp;void&nbsp;<a href="/reference/androidx/paging/PagedList.html#setRetryCallback(java.lang.Runnable)">setRetryCallback</a>(@<a href="/reference/androidx/annotation/Nullable.html">Nullable</a>&nbsp;<a href="/reference/java/lang/Runnable.html">Runnable</a>&nbsp;refreshRetryCallback)</pre>
</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/java/util/List.html">List</a>&lt;T&gt;&nbsp;<a href="/reference/androidx/paging/PagedList.html#snapshot()">snapshot</a>()</pre>
<p>Returns an immutable snapshot of the <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> in its current state.</p>
<p>If this <a href="[is immutable]">is immutable</a><code><a href="/reference/androidx/paging/PagedList.html#isImmutable()">isImmutable</a></code> due to its <code><a href="/reference/androidx/paging/PagingSource.html">PagingSource</a></code> being invalid, it will be returned.</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/java/util/List.html">List</a>&lt;T&gt;</code></td>
<td width="100%">
<p>Immutable snapshot of <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code> data.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>