blob: c1534f8d25cfa533db10ff07aa164bd87ad3ef98 [file] [log] [blame]
<html devsite="true">
<head>
<title>PagingData</title>
{% setvar book_path %}/reference/kotlin/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/_kotlin_switcher2.md" %}
<p>
<pre>class PagingData</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/kotlin/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/kotlin/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 functions</h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagingData.html#filterSync(kotlin.Function1)">filterSync</a>(predicate:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/kotlin/Boolean.html">Boolean</a>)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing only elements matching the given <code><a href="/reference/kotlin/androidx/paging/PagingData.html#predicate()">predicate</a></code></p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagingData.html#flatMapSync(kotlin.Function1)">flatMapSync</a>(transform:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/kotlin/collections/Iterable.html">Iterable</a>&lt;R&gt;)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> of all elements returned from applying the given <code><a href="/reference/kotlin/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagingData.html#insertFooterItem(kotlin.Any)">insertFooterItem</a>(item:&nbsp;T)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed footer <code><a href="/reference/kotlin/androidx/paging/PagingData.html#item()">item</a></code> added to the end of the list.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagingData.html#insertHeaderItem(kotlin.Any)">insertHeaderItem</a>(item:&nbsp;T)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed header <code><a href="/reference/kotlin/androidx/paging/PagingData.html#item()">item</a></code> added to the start of the list.</p>
</td>
</tr>
<tr>
<td><code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</code></td>
<td width="100%">
<div><code><a href="/reference/kotlin/androidx/paging/PagingData.html#mapSync(kotlin.Function1)">mapSync</a>(transform:&nbsp;(T)&nbsp;-&gt;&nbsp;R)</code></div>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing the result of applying the given <code><a href="/reference/kotlin/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Public functions</h2>
<div><a name="filterSync-kotlin.Function1-"></a>
<h3 class="api-name" id="filterSync(kotlin.Function1)">filterSync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html#filterSync(kotlin.Function1)">filterSync</a>(predicate:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/kotlin/Boolean.html">Boolean</a>):&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing only elements matching the given <code><a href="/reference/kotlin/androidx/paging/PagingData.html#predicate()">predicate</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/kotlin/androidx/paging/package-summary.html#filter(androidx.paging.PagingData,kotlin.coroutines.SuspendFunction1)">filter</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="flatMapSync-kotlin.Function1-"></a>
<h3 class="api-name" id="flatMapSync(kotlin.Function1)">flatMapSync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html#flatMapSync(kotlin.Function1)">flatMapSync</a>(transform:&nbsp;(T)&nbsp;-&gt;&nbsp;<a href="/reference/kotlin/kotlin/collections/Iterable.html">Iterable</a>&lt;R&gt;):&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> of all elements returned from applying the given <code><a href="/reference/kotlin/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</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/kotlin/androidx/paging/package-summary.html#flatMap(androidx.paging.PagingData,kotlin.coroutines.SuspendFunction1)">flatMap</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</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/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html#insertFooterItem(kotlin.Any)">insertFooterItem</a>(item:&nbsp;T):&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed footer <code><a href="/reference/kotlin/androidx/paging/PagingData.html#item()">item</a></code> added to the end of the list.</p>
<p>The footer <code><a href="/reference/kotlin/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/kotlin/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/kotlin/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/kotlin/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/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html#insertHeaderItem(kotlin.Any)">insertHeaderItem</a>(item:&nbsp;T):&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;T&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing each original element, with the passed header <code><a href="/reference/kotlin/androidx/paging/PagingData.html#item()">item</a></code> added to the start of the list.</p>
<p>The header <code><a href="/reference/kotlin/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/kotlin/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/kotlin/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/kotlin/androidx/paging/PagingData.html#insertFooterItem(kotlin.Any)">insertFooterItem</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div><a name="mapSync-kotlin.Function1-"></a>
<h3 class="api-name" id="mapSync(kotlin.Function1)">mapSync</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/kotlin/[JVM root]/&lt;ERROR CLASS&gt;.html">&lt;ERROR CLASS&gt;</a><br>fun&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html#mapSync(kotlin.Function1)">mapSync</a>(transform:&nbsp;(T)&nbsp;-&gt;&nbsp;R):&nbsp;<a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a>&lt;R&gt;</pre>
<p>Returns a <code><a href="/reference/kotlin/androidx/paging/PagingData.html">PagingData</a></code> containing the result of applying the given <code><a href="/reference/kotlin/androidx/paging/PagingData.html#transform()">transform</a></code> to each element, as it is loaded.</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/kotlin/kotlinx/coroutines/flow/package-summary.html#map(kotlinx.coroutines.flow.Flow,kotlin.coroutines.SuspendFunction1)">map</a></code></td>
<td width="100%"></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>