blob: 94e965b2d453e07e2b3c5d6c957014f1ea8860cb [file] [log] [blame]
<html devsite="true">
<head>
<title>PagingData</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<h1>PagingData</h1>
{% setvar page_path %}androidx/paging/PagingData.html{% endsetvar %}
{% setvar can_switch %}1{% endsetvar %}
{% include "reference/_java_switcher2.md" %}
<p>
<pre>public final class PagingData&lt;T&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt;</pre>
</p>
<hr>
<p>Container for Paged data from a single generation of loads.</p>
<p>Each refresh of data (generally either pushed by local storage, or pulled from the network) will have a separate corresponding <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code>.</p>
<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/PagingData.Companion.html">PagingData.Companion</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 methods</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>final <a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingData.html#filter(kotlin.Function1)">filter</a>(<a href="/reference/kotlin/jvm/functions/Function1.html">Function1</a>&lt;T,&nbsp;<a href="/reference/java/lang/Boolean.html">Boolean</a>&gt;&nbsp;predicate)</code></div>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing only elements matching the given <code><a href="/reference/androidx/paging/PagingData.html#predicate()">predicate</a></code></p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code>&lt;R&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PagingData.html#flatMap(kotlin.Function1)">flatMap</a>(<a href="/reference/kotlin/jvm/functions/Function1.html">Function1</a>&lt;T,&nbsp;<a href="/reference/java/lang/Iterable.html">Iterable</a>&lt;R&gt;&gt;&nbsp;transform)</code></div>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> of all elements returned from applying the given <code><a href="/reference/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingData.html#insertFooterItem(kotlin.Any)">insertFooterItem</a>(T&nbsp;item)</code></div>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed footer <code><a href="/reference/androidx/paging/PagingData.html#item()">item</a></code> added to the end of the list.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/androidx/paging/PagingData.html#insertHeaderItem(kotlin.Any)">insertHeaderItem</a>(T&nbsp;item)</code></div>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed header <code><a href="/reference/androidx/paging/PagingData.html#item()">item</a></code> added to the start of the list.</p>
</td>
</tr>
<tr>
<td><code>final <a href="/reference/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code>&lt;R&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PagingData.html#map(kotlin.Function1)">map</a>(<a href="/reference/kotlin/jvm/functions/Function1.html">Function1</a>&lt;T,&nbsp;R&gt;&nbsp;transform)</code></div>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing the result of applying the given <code><a href="/reference/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public methods</h2>
<div><a name="filter-kotlin.Function1-"></a>
<h3 class="api-name" id="filter(kotlin.Function1)">filter</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/PagingData.html">PagingData</a>&lt;T&gt;&nbsp;<a href="/reference/androidx/paging/PagingData.html#filter(kotlin.Function1)">filter</a>(<a href="/reference/kotlin/jvm/functions/Function1.html">Function1</a>&lt;T,&nbsp;<a href="/reference/java/lang/Boolean.html">Boolean</a>&gt;&nbsp;predicate)</pre>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing only elements matching the given <code><a href="/reference/androidx/paging/PagingData.html#predicate()">predicate</a></code></p>
</div>
<div><a name="flatMap-kotlin.Function1-"></a>
<h3 class="api-name" id="flatMap(kotlin.Function1)">flatMap</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/PagingData.html">PagingData</a>&lt;R&gt;&nbsp;&lt;R&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PagingData.html#flatMap(kotlin.Function1)">flatMap</a>(<a href="/reference/kotlin/jvm/functions/Function1.html">Function1</a>&lt;T,&nbsp;<a href="/reference/java/lang/Iterable.html">Iterable</a>&lt;R&gt;&gt;&nbsp;transform)</pre>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> of all elements returned from applying the given <code><a href="/reference/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</div>
<div><a name="insertFooterItem-kotlin.Any-"></a>
<h3 class="api-name" id="insertFooterItem(kotlin.Any)">insertFooterItem</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/PagingData.html">PagingData</a>&lt;T&gt;&nbsp;<a href="/reference/androidx/paging/PagingData.html#insertFooterItem(kotlin.Any)">insertFooterItem</a>(T&nbsp;item)</pre>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed footer <code><a href="/reference/androidx/paging/PagingData.html#item()">item</a></code> added to the end of the list.</p>
<p>The footer <code><a href="/reference/androidx/paging/PagingData.html#item()">item</a></code> is added to a loaded page which marks the end of the data stream in the append direction, either by returning null in <code><a href="/reference/androidx/paging/PagingSource.LoadResult.Page.html#nextKey()">PagingSource.LoadResult.Page.nextKey</a></code>. It will be removed if the first page in the list is dropped, which can happen in the case of loaded* pages exceeding <code><a href="/reference/androidx/paging/PagedList.Config.html#maxSize()">PagedList.Config.maxSize</a></code>.</p>
<p>Note: This operation is not idempotent, calling it multiple times will continually add more footers to the end of the list, which can be useful if multiple footer items are required.</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/PagingData.html#insertHeaderItem(kotlin.Any)">insertHeaderItem</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="insertHeaderItem-kotlin.Any-"></a>
<h3 class="api-name" id="insertHeaderItem(kotlin.Any)">insertHeaderItem</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/PagingData.html">PagingData</a>&lt;T&gt;&nbsp;<a href="/reference/androidx/paging/PagingData.html#insertHeaderItem(kotlin.Any)">insertHeaderItem</a>(T&nbsp;item)</pre>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed header <code><a href="/reference/androidx/paging/PagingData.html#item()">item</a></code> added to the start of the list.</p>
<p>The header <code><a href="/reference/androidx/paging/PagingData.html#item()">item</a></code> is added to a loaded page which marks the end of the data stream in the prepend direction by returning null in <code><a href="/reference/androidx/paging/PagingSource.LoadResult.Page.html#prevKey()">PagingSource.LoadResult.Page.prevKey</a></code>. It will be removed if the first page in the list is dropped, which can happen in the case of loaded pages exceeding <code><a href="/reference/androidx/paging/PagedList.Config.html#maxSize()">PagedList.Config.maxSize</a></code>.</p>
<p>Note: This operation is not idempotent, calling it multiple times will continually add more headers to the start of the list, which can be useful if multiple header items are required.</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/PagingData.html#insertFooterItem(kotlin.Any)">insertFooterItem</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="map-kotlin.Function1-"></a>
<h3 class="api-name" id="map(kotlin.Function1)">map</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/PagingData.html">PagingData</a>&lt;R&gt;&nbsp;&lt;R&nbsp;extends&nbsp;<a href="/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PagingData.html#map(kotlin.Function1)">map</a>(<a href="/reference/kotlin/jvm/functions/Function1.html">Function1</a>&lt;T,&nbsp;R&gt;&nbsp;transform)</pre>
<p>Returns a <code><a href="/reference/androidx/paging/PagingData.html">PagingData</a></code> containing the result of applying the given <code><a href="/reference/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</div>
</body>
</html>