| <html devsite="true"> |
| <head> |
| <title>PageKeyedDataSource</title> |
| {% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} |
| {% include "_shared/_reference-head-tags.html" %} |
| </head> |
| <body> |
| <h1>PageKeyedDataSource</h1> |
| {% setvar page_path %}androidx/paging/PageKeyedDataSource.html{% endsetvar %} |
| {% setvar can_switch %}1{% endsetvar %} |
| {% include "reference/_java_switcher2.md" %} |
| <p> |
| <pre>public abstract class PageKeyedDataSource<Key extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, Value extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> 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">Object</a></td> |
| </tr> |
| <tr> |
| <td class="jd-inheritance-space"> ↳</td> |
| <td colspan="2"><a href="/reference/androidx/paging/DataSource.html">DataSource</a></td> |
| </tr> |
| <tr> |
| <td> </td> |
| <td class="jd-inheritance-space"> ↳</td> |
| <td colspan="1"><a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <hr> |
| <aside class="caution"><strong>This class is deprecated.</strong><br>PageKeyedDataSource is deprecated and has been replaced by PagingSource</aside> |
| <p>Incremental data loader for page-keyed content, where requests return keys for next/previous pages.</p> |
| <p>Implement a <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code> using <code><a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a></code> if you need to use data from page <code>N - 1</code> to load page <code>N</code>. This is common, for example, in network APIs that include a next/previous link or key with each page load.</p> |
| <p>The <code>InMemoryByPageRepository</code> in the <a href="https://github.com/googlesamples/android-architecture-components/blob/master/PagingWithNetworkSample/README.md">PagingWithNetworkSample</a> shows how to implement a network PageKeyedDataSource using <a href="https://square.github.io/retrofit/">Retrofit</a>, while handling swipe-to-refresh, network errors, and retry.</p> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><Key extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of data used to query Value types out of the <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><Value extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of items being loaded by the <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code>.</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/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a></code></td> |
| <td width="100%"> |
| <p>Callback for <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadBefore(androidx.paging.PageKeyedDataSource.LoadParams)">loadBefore</a></code> and <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadAfter(androidx.paging.PageKeyedDataSource.LoadParams)">loadAfter</a></code> to return data.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialCallback.html">PageKeyedDataSource.LoadInitialCallback</a></code></td> |
| <td width="100%"> |
| <p>Callback for <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams)">loadInitial</a></code> to return data and, optionally, position/count information.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialParams.html">PageKeyedDataSource.LoadInitialParams</a></code></td> |
| <td width="100%"> |
| <p>Holder object for inputs to <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams)">loadInitial</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a></code></td> |
| <td width="100%"> |
| <p>Holder object for inputs to <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadBefore(androidx.paging.PageKeyedDataSource.LoadParams)">loadBefore</a></code> and <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadAfter(androidx.paging.PageKeyedDataSource.LoadParams)">loadAfter</a></code>.</p> |
| </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>boolean</code></td> |
| <td width="100%"> |
| <div><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#isInvalid()">isInvalid</a></code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Public constructors</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td> |
| <div><code><Key extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, Value extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#PageKeyedDataSource()">PageKeyedDataSource</a>()</code></div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2"><h3>Public methods</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code>abstract void</code></td> |
| <td width="100%"> |
| <div><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadAfter(androidx.paging.PageKeyedDataSource.LoadParams,androidx.paging.PageKeyedDataSource.LoadCallback)">loadAfter</a>(<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a><Key> params,<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a><Key, Value> callback<br>)</code></div> |
| <p>Append page with the key specified by <code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html#key()">LoadParams.key</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>abstract void</code></td> |
| <td width="100%"> |
| <div><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadBefore(androidx.paging.PageKeyedDataSource.LoadParams,androidx.paging.PageKeyedDataSource.LoadCallback)">loadBefore</a>(<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a><Key> params,<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a><Key, Value> callback<br>)</code></div> |
| <p>Prepend page with the key specified by <code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html#key()">LoadParams.key</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>abstract void</code></td> |
| <td width="100%"> |
| <div><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams,androidx.paging.PageKeyedDataSource.LoadInitialCallback)">loadInitial</a>(<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialParams.html">PageKeyedDataSource.LoadInitialParams</a><Key> params,<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialCallback.html">PageKeyedDataSource.LoadInitialCallback</a><Key, Value> callback<br>)</code></div> |
| <p>Load initial data.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <div><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#map()">map</a>(<a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a><Value, ToValue> function)</code></div> |
| <p>Applies the given function to each value emitted by the DataSource.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <div><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#map(kotlin.Function1)">map</a>(Function1<Value, ToValue> function)</code></div> |
| <p>Applies the given function to each value emitted by the DataSource.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <div><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage()">mapByPage</a>(<br> <a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a><<a href="https://developer.android.com/reference/java/util/List.html">List</a><Value>, <a href="https://developer.android.com/reference/java/util/List.html">List</a><ToValue>> function<br>)</code></div> |
| <p>Applies the given function to each value emitted by the DataSource.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <div><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage(kotlin.Function1)">mapByPage</a>(<br> Function1<<a href="https://developer.android.com/reference/java/util/List.html">List</a><Value>, <a href="https://developer.android.com/reference/java/util/List.html">List</a><ToValue>> 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="2"><h3>Inherited methods</h3></th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><devsite-expandable><span class="expand-control">From class <a href="/reference/androidx/paging/DataSource.html">DataSource</a></span> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <tbody> |
| <tr> |
| <td><code>@<a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a> void</code></td> |
| <td width="100%"> |
| <div><code><a href="/reference/androidx/paging/DataSource.html#addInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback)">addInvalidatedCallback</a>(<br> <a href="/reference/androidx/paging/DataSource.InvalidatedCallback.html">DataSource.InvalidatedCallback</a> onInvalidatedCallback<br>)</code></div> |
| <p>Add a callback to invoke when the DataSource is first invalidated.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>@<a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a> void</code></td> |
| <td width="100%"> |
| <div><code><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><code>@<a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a> void</code></td> |
| <td width="100%"> |
| <div><code><a href="/reference/androidx/paging/DataSource.html#removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback)">removeInvalidatedCallback</a>(<br> <a href="/reference/androidx/paging/DataSource.InvalidatedCallback.html">DataSource.InvalidatedCallback</a> onInvalidatedCallback<br>)</code></div> |
| <p>Remove a previously added invalidate callback.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </devsite-expandable> </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <h2>Public fields</h2> |
| <div><a name="getIsInvalid()"></a><a name="setIsInvalid()"></a><a name="getIsInvalid--"></a><a name="setIsInvalid--"></a> |
| <h3 class="api-name" id="isInvalid()">isInvalid</h3> |
| <pre class="api-signature no-pretty-print">public boolean <a href="/reference/androidx/paging/PageKeyedDataSource.html#isInvalid()">isInvalid</a></pre> |
| <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 invalid, and can no longer be queried for data.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <h2>Public constructors</h2> |
| <div><a name="PageKeyedDataSource--"></a> |
| <h3 class="api-name" id="PageKeyedDataSource()">PageKeyedDataSource</h3> |
| <pre class="api-signature no-pretty-print">public final <Key extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>, Value extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#PageKeyedDataSource()">PageKeyedDataSource</a>()</pre> |
| <div class="devsite-table-wrapper"> |
| <table class="responsive"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><Key extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of data used to query Value types out of the <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code>.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><Value extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of items being loaded by the <code><a href="/reference/androidx/paging/DataSource.html">DataSource</a></code>.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <h2>Public methods</h2> |
| <div><a name="loadAfter(androidx.paging.PageKeyedDataSource.LoadParams, androidx.paging.PageKeyedDataSource.LoadCallback)"></a><a name="loadAfter-androidx.paging.PageKeyedDataSource.LoadParams-androidx.paging.PageKeyedDataSource.LoadCallback-"></a> |
| <h3 class="api-name" id="loadAfter(androidx.paging.PageKeyedDataSource.LoadParams,androidx.paging.PageKeyedDataSource.LoadCallback)">loadAfter</h3> |
| <pre class="api-signature no-pretty-print">public abstract void <a href="/reference/androidx/paging/PageKeyedDataSource.html#loadAfter(androidx.paging.PageKeyedDataSource.LoadParams,androidx.paging.PageKeyedDataSource.LoadCallback)">loadAfter</a>(<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a><Key> params,<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a><Key, Value> callback<br>)</pre> |
| <p>Append page with the key specified by <code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html#key()">LoadParams.key</a></code>.</p> |
| <p>It's valid to return a different list size than the page size if it's easier, e.g. if your backend defines page sizes. It is generally preferred to increase the number loaded than reduce.</p> |
| <p>Data may be passed synchronously during the load method, or deferred and called at a later time. Further loads going down will be blocked until the callback is called.</p> |
| <p>If data cannot be loaded (for example, if the request is invalid, or the data would be stale and inconsistent), it is valid to call <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#invalidate()">invalidate</a></code> to invalidate the data source, and prevent further loading.</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/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a><Key> params</code></td> |
| <td width="100%"> |
| <p>Parameters for the load, including the key for the new page, and requested load size.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a><Key, Value> callback</code></td> |
| <td width="100%"> |
| <p>Callback that receives loaded data.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="loadBefore(androidx.paging.PageKeyedDataSource.LoadParams, androidx.paging.PageKeyedDataSource.LoadCallback)"></a><a name="loadBefore-androidx.paging.PageKeyedDataSource.LoadParams-androidx.paging.PageKeyedDataSource.LoadCallback-"></a> |
| <h3 class="api-name" id="loadBefore(androidx.paging.PageKeyedDataSource.LoadParams,androidx.paging.PageKeyedDataSource.LoadCallback)">loadBefore</h3> |
| <pre class="api-signature no-pretty-print">public abstract void <a href="/reference/androidx/paging/PageKeyedDataSource.html#loadBefore(androidx.paging.PageKeyedDataSource.LoadParams,androidx.paging.PageKeyedDataSource.LoadCallback)">loadBefore</a>(<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a><Key> params,<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a><Key, Value> callback<br>)</pre> |
| <p>Prepend page with the key specified by <code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadParams.html#key()">LoadParams.key</a></code>.</p> |
| <p>It's valid to return a different list size than the page size if it's easier, e.g. if your backend defines page sizes. It is generally preferred to increase the number loaded than reduce.</p> |
| <p>Data may be passed synchronously during the load method, or deferred and called at a later time. Further loads going down will be blocked until the callback is called.</p> |
| <p>If data cannot be loaded (for example, if the request is invalid, or the data would be stale and inconsistent), it is valid to call <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#invalidate()">invalidate</a></code> to invalidate the data source, and prevent further loading.</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/PageKeyedDataSource.LoadParams.html">PageKeyedDataSource.LoadParams</a><Key> params</code></td> |
| <td width="100%"> |
| <p>Parameters for the load, including the key for the new page, and requested load size.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadCallback.html">PageKeyedDataSource.LoadCallback</a><Key, Value> callback</code></td> |
| <td width="100%"> |
| <p>Callback that receives loaded data.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams, androidx.paging.PageKeyedDataSource.LoadInitialCallback)"></a><a name="loadInitial-androidx.paging.PageKeyedDataSource.LoadInitialParams-androidx.paging.PageKeyedDataSource.LoadInitialCallback-"></a> |
| <h3 class="api-name" id="loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams,androidx.paging.PageKeyedDataSource.LoadInitialCallback)">loadInitial</h3> |
| <pre class="api-signature no-pretty-print">public abstract void <a href="/reference/androidx/paging/PageKeyedDataSource.html#loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams,androidx.paging.PageKeyedDataSource.LoadInitialCallback)">loadInitial</a>(<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialParams.html">PageKeyedDataSource.LoadInitialParams</a><Key> params,<br> <a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialCallback.html">PageKeyedDataSource.LoadInitialCallback</a><Key, Value> callback<br>)</pre> |
| <p>Load initial data.</p> |
| <p>This method is called first to initialize a PagedList with data. If it's possible to count the items that can be loaded by the DataSource, it's recommended to pass the loaded data to the callback via the three-parameter <code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialCallback.html#onResult(kotlin.collections.List,kotlin.Int,kotlin.Int,kotlin.Any,kotlin.Any)">LoadInitialCallback.onResult</a></code>. This enables PagedLists presenting data from this source to display placeholders to represent unloaded items.</p> |
| <p><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialParams.html#requestedLoadSize()">LoadInitialParams.requestedLoadSize</a></code> is a hint, not a requirement, so it may be may be altered or ignored.</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/PageKeyedDataSource.LoadInitialParams.html">PageKeyedDataSource.LoadInitialParams</a><Key> params</code></td> |
| <td width="100%"> |
| <p>Parameters for initial load, including requested load size.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.LoadInitialCallback.html">PageKeyedDataSource.LoadInitialCallback</a><Key, Value> callback</code></td> |
| <td width="100%"> |
| <p>Callback that receives initial load data.</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="map--"></a> |
| <h3 class="api-name" id="map()">map</h3> |
| <pre class="api-signature no-pretty-print">public final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue> <ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#map()">map</a>(<a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a><Value, ToValue> function)</pre> |
| <p>Applies the given function to each value emitted by the DataSource.</p> |
| <p>Same as <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage()">mapByPage</a></code>, but operates on individual items.</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/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of items produced by the new DataSource, from the passed function.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a><Value, ToValue> function</code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">See also</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage()">mapByPage</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#map()">map</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage()">mapByPage</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">public final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue> <ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#map(kotlin.Function1)">map</a>(Function1<Value, ToValue> function)</pre> |
| <p>Applies the given function to each value emitted by the DataSource.</p> |
| <p>Same as <code><a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage()">mapByPage</a></code>, but operates on individual items.</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/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of items produced by the new DataSource, from the passed function.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>Function1<Value, ToValue> function</code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">See also</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage()">mapByPage</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#map()">map</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage()">mapByPage</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="mapByPage--"></a> |
| <h3 class="api-name" id="mapByPage()">mapByPage</h3> |
| <pre class="api-signature no-pretty-print">public final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue> <ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage()">mapByPage</a>(<br> <a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a><<a href="https://developer.android.com/reference/java/util/List.html">List</a><Value>, <a href="https://developer.android.com/reference/java/util/List.html">List</a><ToValue>> 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/PageKeyedDataSource.html#map()">map</a></code>, but allows for batch conversions.</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/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of items produced by the new DataSource, from the passed function.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/[JVM root]/<ERROR CLASS>.html"><ERROR CLASS></a><<a href="https://developer.android.com/reference/java/util/List.html">List</a><Value>, <a href="https://developer.android.com/reference/java/util/List.html">List</a><ToValue>> function</code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">See also</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#map()">map</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#map()">map</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage()">mapByPage</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| <div><a name="mapByPage-kotlin.Function1-"></a> |
| <h3 class="api-name" id="mapByPage(kotlin.Function1)">mapByPage</h3> |
| <pre class="api-signature no-pretty-print">public final <a href="/reference/androidx/paging/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue> <ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>> <a href="/reference/androidx/paging/PageKeyedDataSource.html#mapByPage(kotlin.Function1)">mapByPage</a>(<br> Function1<<a href="https://developer.android.com/reference/java/util/List.html">List</a><Value>, <a href="https://developer.android.com/reference/java/util/List.html">List</a><ToValue>> 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/PageKeyedDataSource.html#map()">map</a></code>, but allows for batch conversions.</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/PageKeyedDataSource.html">PageKeyedDataSource</a><Key, ToValue></code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">Parameters</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><ToValue extends <a href="https://developer.android.com/reference/java/lang/Object.html">Object</a>></code></td> |
| <td width="100%"> |
| <p>Type of items produced by the new DataSource, from the passed function.</p> |
| </td> |
| </tr> |
| <tr> |
| <td><code>Function1<<a href="https://developer.android.com/reference/java/util/List.html">List</a><Value>, <a href="https://developer.android.com/reference/java/util/List.html">List</a><ToValue>> function</code></td> |
| <td width="100%"> |
| <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"> |
| <thead> |
| <tr> |
| <th colspan="2">See also</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/PageKeyedDataSource.html#map()">map</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#map()">map</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| <tr> |
| <td><code><a href="/reference/androidx/paging/DataSource.Factory.html#mapByPage()">mapByPage</a></code></td> |
| <td width="100%"></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| </div> |
| </body> |
| </html> |