blob: fe06bb2b082487355c4cacb21104daf728239d6f [file] [log] [blame]
<html devsite="true">
<head>
<title>PositionalDataSource</title>
{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %}
{% include "_shared/_reference-head-tags.html" %}
</head>
<body>
<div id="metadata-info-block"></div>
<h1>PositionalDataSource</h1>
<p>
<pre>public abstract class <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; extends <a href="/reference/androidx/paging/DataSource.html">DataSource</a></pre>
</p>
<div class="devsite-table-wrapper">
<table class="jd-inheritance-table">
<tbody>
<tr>
<td colspan="3"><a href="https://developer.android.com/reference/java/lang/Object.html">java.lang.Object</a></td>
</tr>
<tr>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="2"><a href="/reference/androidx/paging/DataSource.html">androidx.paging.DataSource</a></td>
</tr>
<tr>
<td>&nbsp;</td>
<td class="jd-inheritance-space">&nbsp;&nbsp;&nbsp;↳</td>
<td colspan="1"><a href="/reference/androidx/paging/PositionalDataSource.html">androidx.paging.PositionalDataSource</a></td>
</tr>
</tbody>
</table>
</div>
<hr>
<aside class="caution"><strong>This class is deprecated.</strong><br>PositionalDataSource is deprecated and has been replaced by PagingSource</aside>
<p>Position-based data loader for a fixed-size, countable data set, supporting fixed-size loads at arbitrary page positions.</p>
<p>Extend PositionalDataSource if you can load pages of a requested size at arbitrary positions, and provide a fixed item count. If your data source can't support loading arbitrary requested page sizes (e.g. when network page size constraints are only known at runtime), either use <code><a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a></code> or <code><a href="/reference/androidx/paging/ItemKeyedDataSource.html">ItemKeyedDataSource</a></code>, or pass the initial result with the two parameter <code><a href="/reference/androidx/paging/PositionalDataSource.LoadInitialCallback.html#onResult(kotlin.collections.List,kotlin.Int,kotlin.Int)">LoadInitialCallback.onResult</a></code>.</p>
<p>Room can generate a Factory of PositionalDataSources for you:</p>
<pre class="prettyprint">@Dao<br>interface UserDao {<br> @Query(&quot;SELECT * FROM user ORDER BY age DESC&quot;)<br> public abstract DataSource.Factory&lt;Integer, User&gt; loadUsersByAgeDesc();<br>}</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;</code></td>
<td>
<p>Type of items being loaded by the <code><a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<h2>Summary</h2>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Nested types</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td>
<div><code>public abstract class <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialCallback.html">PositionalDataSource.LoadInitialCallback</a>&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;</code></div>
<p>Callback for <code><a href="/reference/androidx/paging/PositionalDataSource.html#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)">loadInitial</a></code> to return data, position, and count.</p>
</td>
</tr>
<tr>
<td>
<div><code>public class <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialParams.html">PositionalDataSource.LoadInitialParams</a></code></div>
<p>Holder object for inputs to <code><a href="/reference/androidx/paging/PositionalDataSource.html#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)">loadInitial</a></code>.</p>
</td>
</tr>
<tr>
<td>
<div><code>public abstract class <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeCallback.html">PositionalDataSource.LoadRangeCallback</a>&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;</code></div>
<p>Callback for PositionalDataSource <code><a href="/reference/androidx/paging/PositionalDataSource.html#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams)">loadRange</a></code> to return data.</p>
</td>
</tr>
<tr>
<td>
<div><code>public class <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeParams.html">PositionalDataSource.LoadRangeParams</a></code></div>
<p>Holder object for inputs to <code><a href="/reference/androidx/paging/PositionalDataSource.html#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams)">loadRange</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public constructors</h3></th>
</tr>
</thead>
<tbody class="list">
<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/PositionalDataSource.html#PositionalDataSource()">PositionalDataSource</a>()</code></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%"><h3>Public methods</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>abstract void</code></td>
<td>
<div><code>@<a href="/reference/androidx/annotation/WorkerThread.html">WorkerThread</a><br><a href="/reference/androidx/paging/PositionalDataSource.html#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams,androidx.paging.PositionalDataSource.LoadInitialCallback)">loadInitial</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialParams.html">PositionalDataSource.LoadInitialParams</a>&nbsp;params,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialCallback.html">PositionalDataSource.LoadInitialCallback</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;callback<br>)</code></div>
<p>Load initial list data.</p>
</td>
</tr>
<tr>
<td width="40%"><code>abstract void</code></td>
<td>
<div><code>@<a href="/reference/androidx/annotation/WorkerThread.html">WorkerThread</a><br><a href="/reference/androidx/paging/PositionalDataSource.html#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams,androidx.paging.PositionalDataSource.LoadRangeCallback)">loadRange</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeParams.html">PositionalDataSource.LoadRangeParams</a>&nbsp;params,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeCallback.html">PositionalDataSource.LoadRangeCallback</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;callback<br>)</code></div>
<p>Called to load a range of data from the DataSource.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<div><code>&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/arch/core/util/Function.html">Function</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;function)</code></div>
<p>Applies the given function to each value emitted by the DataSource.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<div><code>&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#map(kotlin.Function1)">map</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;function)</code></div>
<p>Applies the given function to each value emitted by the DataSource.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<div><code>&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/arch/core/util/Function.html">Function</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&gt;&nbsp;function<br>)</code></div>
<p>Applies the given function to each value emitted by the DataSource.</p>
</td>
</tr>
<tr>
<td width="40%"><code>final @<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<div><code>&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(kotlin.Function1)">mapByPage</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&gt;&nbsp;function<br>)</code></div>
<p>Applies the given function to each value emitted by the DataSource.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive" id="inhmethods">
<thead>
<tr>
<th colspan="100%"><h3>Inherited fields</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><devsite-expandable><span class="expand-control">From <a href="/reference/androidx/paging/DataSource.html">androidx.paging.DataSource</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<tbody class="list">
<tr>
<td width="40%"><code>boolean</code></td>
<td>
<div><code><a href="/reference/androidx/paging/DataSource.html#isInvalid()">isInvalid</a></code></div>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive" id="inhmethods">
<thead>
<tr>
<th colspan="100%"><h3>Inherited methods</h3></th>
</tr>
</thead>
<tbody class="list">
<tr>
<td><devsite-expandable><span class="expand-control">From <a href="/reference/androidx/paging/DataSource.html">androidx.paging.DataSource</a></span>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<tbody class="list">
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code>@<a href="/reference/androidx/annotation/AnyThread.html">AnyThread</a><br><a href="/reference/androidx/paging/DataSource.html#addInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback)">addInvalidatedCallback</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/DataSource.InvalidatedCallback.html">DataSource.InvalidatedCallback</a>&nbsp;onInvalidatedCallback<br>)</code></div>
<p>Add a callback to invoke when the DataSource is first invalidated.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code>@<a href="/reference/androidx/annotation/AnyThread.html">AnyThread</a><br><a href="/reference/androidx/paging/DataSource.html#invalidate()">invalidate</a>()</code></div>
<p>Signal the data source to stop loading, and notify its callback.</p>
</td>
</tr>
<tr>
<td width="40%"><code>void</code></td>
<td>
<div><code>@<a href="/reference/androidx/annotation/AnyThread.html">AnyThread</a><br><a href="/reference/androidx/paging/DataSource.html#removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback)">removeInvalidatedCallback</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/DataSource.InvalidatedCallback.html">DataSource.InvalidatedCallback</a>&nbsp;onInvalidatedCallback<br>)</code></div>
<p>Remove a previously added invalidate callback.</p>
</td>
</tr>
</tbody>
</table>
</div>
</devsite-expandable> </td>
</tr>
</tbody>
</table>
</div>
<div class="list">
<h2>Public constructors</h2>
<div class="api-item"><a name="PositionalDataSource--"></a><a name="positionaldatasource"></a>
<h3 class="api-name" id="PositionalDataSource()">PositionalDataSource</h3>
<pre class="api-signature no-pretty-print">public&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/PositionalDataSource.html#PositionalDataSource()">PositionalDataSource</a>()</pre>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>&lt;T&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt;</code></td>
<td>
<p>Type of items being loaded by the <code><a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a></code>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="list">
<h2>Public methods</h2>
<div class="api-item"><a name="loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams, androidx.paging.PositionalDataSource.LoadInitialCallback)"></a><a name="loadInitial-androidx.paging.PositionalDataSource.LoadInitialParams-androidx.paging.PositionalDataSource.LoadInitialCallback-"></a><a name="loadinitial"></a>
<h3 class="api-name" id="loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams,androidx.paging.PositionalDataSource.LoadInitialCallback)">loadInitial</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/WorkerThread.html">WorkerThread</a><br>public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/paging/PositionalDataSource.html#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams,androidx.paging.PositionalDataSource.LoadInitialCallback)">loadInitial</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialParams.html">PositionalDataSource.LoadInitialParams</a>&nbsp;params,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialCallback.html">PositionalDataSource.LoadInitialCallback</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;callback<br>)</pre>
<p>Load initial list data.</p>
<p>This method is called to load the initial page(s) from the <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code>.</p>
<p>LoadResult list must be a multiple of pageSize to enable efficient tiling.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialParams.html">PositionalDataSource.LoadInitialParams</a>&nbsp;params</code></td>
<td>
<p>Parameters for initial load, including requested start position, load size, and page size.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadInitialCallback.html">PositionalDataSource.LoadInitialCallback</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;callback</code></td>
<td>
<p>Callback that receives initial load data, including position and total data set size.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="loadRange(androidx.paging.PositionalDataSource.LoadRangeParams, androidx.paging.PositionalDataSource.LoadRangeCallback)"></a><a name="loadRange-androidx.paging.PositionalDataSource.LoadRangeParams-androidx.paging.PositionalDataSource.LoadRangeCallback-"></a><a name="loadrange"></a>
<h3 class="api-name" id="loadRange(androidx.paging.PositionalDataSource.LoadRangeParams,androidx.paging.PositionalDataSource.LoadRangeCallback)">loadRange</h3>
<pre class="api-signature no-pretty-print">@<a href="/reference/androidx/annotation/WorkerThread.html">WorkerThread</a><br>public&nbsp;abstract&nbsp;void&nbsp;<a href="/reference/androidx/paging/PositionalDataSource.html#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams,androidx.paging.PositionalDataSource.LoadRangeCallback)">loadRange</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeParams.html">PositionalDataSource.LoadRangeParams</a>&nbsp;params,<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeCallback.html">PositionalDataSource.LoadRangeCallback</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;callback<br>)</pre>
<p>Called to load a range of data from the DataSource.</p>
<p>This method is called to load additional pages from the DataSource after the <code><a href="/reference/androidx/paging/PositionalDataSource.LoadInitialCallback.html">LoadInitialCallback</a></code> passed to dispatchLoadInitial has initialized a <code><a href="/reference/androidx/paging/PagedList.html">PagedList</a></code>.</p>
<p>Unlike <code><a href="/reference/androidx/paging/PositionalDataSource.html#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)">loadInitial</a></code>, this method must return the number of items requested, at the position requested.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeParams.html">PositionalDataSource.LoadRangeParams</a>&nbsp;params</code></td>
<td>
<p>Parameters for load, including start position and load size.</p>
</td>
</tr>
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.LoadRangeCallback.html">PositionalDataSource.LoadRangeCallback</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;&nbsp;callback</code></td>
<td>
<p>Callback that receives loaded data.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="map-androidx.arch.core.util.Function-"></a><a name="map"></a>
<h3 class="api-name" id="map(androidx.arch.core.util.Function)">map</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/arch/core/util/Function.html">Function</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;function)</pre>
<p>Applies the given function to each value emitted by the DataSource.</p>
<p>Same as <code><a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code>, but operates on individual items.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/arch/core/util/Function.html">Function</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;function</code></td>
<td>
<p>Function that runs on each loaded item, returning items of a potentially new type.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<p>A new DataSource, which transforms items using the given function.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#map(androidx.arch.core.util.Function)">map</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="map-kotlin.Function1-"></a><a name="map"></a>
<h3 class="api-name" id="map(kotlin.Function1)">map</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#map(kotlin.Function1)">map</a>(@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;function)</pre>
<p>Applies the given function to each value emitted by the DataSource.</p>
<p>An overload of <code><a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a></code> that accepts a kotlin function type.</p>
<p>Same as <code><a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code>, but operates on individual items.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;function</code></td>
<td>
<p>Function that runs on each loaded item, returning items of a potentially new type.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<p>A new DataSource, which transforms items using the given function.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#map(androidx.arch.core.util.Function)">map</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="mapByPage-androidx.arch.core.util.Function-"></a><a name="mapbypage"></a>
<h3 class="api-name" id="mapByPage(androidx.arch.core.util.Function)">mapByPage</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/arch/core/util/Function.html">Function</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&gt;&nbsp;function<br>)</pre>
<p>Applies the given function to each value emitted by the DataSource.</p>
<p>Same as <code><a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a></code>, but allows for batch conversions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/arch/core/util/Function.html">Function</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&gt;&nbsp;function</code></td>
<td>
<p>Function that runs on each loaded page, returning items of a potentially new type.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<p>A new DataSource, which transforms items using the given function.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#map(androidx.arch.core.util.Function)">map</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api-item"><a name="mapByPage-kotlin.Function1-"></a><a name="mapbypage"></a>
<h3 class="api-name" id="mapByPage(kotlin.Function1)">mapByPage</h3>
<pre class="api-signature no-pretty-print">public&nbsp;final&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&nbsp;&lt;V&nbsp;extends&nbsp;<a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>&gt; <a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(kotlin.Function1)">mapByPage</a>(<br>&nbsp;&nbsp;&nbsp;&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&gt;&nbsp;function<br>)</pre>
<p>Applies the given function to each value emitted by the DataSource.</p>
<p>An overload of <code><a href="/reference/androidx/paging/PositionalDataSource.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code> that accepts a kotlin function type.</p>
<p>Same as <code><a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a></code>, but allows for batch conversions.</p>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Parameters</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> Function1&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> T&gt;,&nbsp;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="https://developer.android.com/reference/java/util/List.html">List</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;&gt;&nbsp;function</code></td>
<td>
<p>Function that runs on each loaded page, returning items of a potentially new type.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">Returns</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code>@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> <a href="/reference/androidx/paging/PositionalDataSource.html">PositionalDataSource</a>&lt;@<a href="/reference/androidx/annotation/NonNull.html">NonNull</a> V&gt;</code></td>
<td>
<p>A new <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code>, which transforms items using the given function.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="devsite-table-wrapper">
<table class="responsive">
<colgroup>
<col width="40%">
<col>
</colgroup>
<thead>
<tr>
<th colspan="100%">See also</th>
</tr>
</thead>
<tbody class="list">
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/PositionalDataSource.html#map(androidx.arch.core.util.Function)">map</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#map(androidx.arch.core.util.Function)">map</a></code></td>
<td></td>
</tr>
<tr>
<td width="40%"><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage(androidx.arch.core.util.Function)">mapByPage</a></code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>