# PositionalDataSource

Artifact: [androidx.paging:paging-common](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/PositionalDataSource.jvmAndAndroid.kt+class:androidx.paging.PositionalDataSource) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

*** ** * ** ***


```
public abstract class PositionalDataSource<T extends Object> extends DataSource<@NonNull Integer, @NonNull T>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.paging.DataSource](https://developer.android.com/reference/androidx/paging/DataSource)\<@[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) [Integer](https://developer.android.com/reference/java/lang/Integer.html), @[NonNull](https://developer.android.com/reference/androidx/annotation/NonNull) T\> ||
|   | ↳ | [androidx.paging.PositionalDataSource](https://developer.android.com/reference/androidx/paging/PositionalDataSource) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Position-based data loader for a fixed-size, countable data set, supporting fixed-size loads at arbitrary page positions.

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 `https://developer.android.com/reference/androidx/paging/PageKeyedDataSource` or `https://developer.android.com/reference/androidx/paging/ItemKeyedDataSource`, or pass the initial result with the two parameter `https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialCallback#onResult(kotlin.collections.List,kotlin.Int,kotlin.Int)`.

Room can generate a Factory of PositionalDataSources for you:

```
@Dao
interface UserDao {
    @Query("SELECT * FROM user ORDER BY age DESC")
    public abstract DataSource.Factory<Integer, User> loadUsersByAgeDesc();
}
```

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | Type of items being loaded by the `https://developer.android.com/reference/androidx/paging/PositionalDataSource`. |

## Summary

| ### Nested types |
|---|
| `public abstract class https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialCallback<T extends https://developer.android.com/reference/java/lang/Object.html>` **This class is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `public class https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams` **This class is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `public abstract class https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadRangeCallback<T extends https://developer.android.com/reference/java/lang/Object.html>` **This class is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `public class https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadRangeParams` **This class is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |

| ### Public constructors |
|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html> [PositionalDataSource](https://developer.android.com/reference/androidx/paging/PositionalDataSource#PositionalDataSource())()` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |

| ### Public methods |
|---|---|
| `static final int` | `[computeInitialLoadPosition](https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadPosition(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams params, int totalCount )` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `static final int` | `[computeInitialLoadSize](https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadSize(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int,kotlin.Int))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams params, int initialLoadPosition, int totalCount )` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread [loadInitial](https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams,androidx.paging.PositionalDataSource.LoadInitialCallback))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams params, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> callback )` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `abstract void` | `@https://developer.android.com/reference/androidx/annotation/WorkerThread [loadRange](https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams,androidx.paging.PositionalDataSource.LoadRangeCallback))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadRangeParams params, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadRangeCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> callback )` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | `<V extends https://developer.android.com/reference/java/lang/Object.html> [map](https://developer.android.com/reference/androidx/paging/PositionalDataSource#map(androidx.arch.core.util.Function))(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/arch/core/util/Function<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull V> function)` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | `<V extends https://developer.android.com/reference/java/lang/Object.html> [map](https://developer.android.com/reference/androidx/paging/PositionalDataSource#map(kotlin.Function1))(@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull V> function)` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | `<V extends https://developer.android.com/reference/java/lang/Object.html> [mapByPage](https://developer.android.com/reference/androidx/paging/PositionalDataSource#mapByPage(androidx.arch.core.util.Function))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/arch/core/util/Function<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull T>, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull V>> function )` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | `<V extends https://developer.android.com/reference/java/lang/Object.html> [mapByPage](https://developer.android.com/reference/androidx/paging/PositionalDataSource#mapByPage(kotlin.Function1))( @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull T>, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull V>> function )` **This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource |

### Inherited methods

From [androidx.paging.DataSource](https://developer.android.com/reference/androidx/paging/DataSource) `void` `@https://developer.android.com/reference/androidx/annotation/AnyThread
[addInvalidatedCallback](https://developer.android.com/reference/androidx/paging/DataSource#addInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback))(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.InvalidatedCallback onInvalidatedCallback
)`

**This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource
`void` `@https://developer.android.com/reference/androidx/annotation/AnyThread
[invalidate](https://developer.android.com/reference/androidx/paging/DataSource#invalidate())()`

**This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource
`boolean` `@https://developer.android.com/reference/androidx/annotation/WorkerThread
[isInvalid](https://developer.android.com/reference/androidx/paging/DataSource#isInvalid())()`

**This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource
`void` `@https://developer.android.com/reference/androidx/annotation/AnyThread
[removeInvalidatedCallback](https://developer.android.com/reference/androidx/paging/DataSource#removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback))(
@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/DataSource.InvalidatedCallback onInvalidatedCallback
)`

**This method is deprecated.** PositionalDataSource is deprecated and has been replaced by PagingSource

## Public constructors

### PositionalDataSource

```
public <T extends Object> [PositionalDataSource](https://developer.android.com/reference/androidx/paging/PositionalDataSource#PositionalDataSource())()
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | Type of items being loaded by the `https://developer.android.com/reference/androidx/paging/PositionalDataSource`. |

## Public methods

### computeInitialLoadPosition

Added in [3.3.0](https://developer.android.com/jetpack/androidx/releases/paging#3.3.0) Deprecated in [3.3.0](https://developer.android.com/jetpack/androidx/releases/paging#3.3.0)

```
public static final int [computeInitialLoadPosition](https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadPosition(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int))(
    @NonNull PositionalDataSource.LoadInitialParams params,
    int totalCount
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Helper for computing an initial position in `https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)` when total data set size can be computed ahead of loading.

The value computed by this function will do bounds checking, page alignment, and positioning based on initial load size requested.

Example usage in a `https://developer.android.com/reference/androidx/paging/PositionalDataSource` subclass:

```
class ItemDataSource extends PositionalDataSource<Item> {
    private int computeCount() {
        // actual count code here
    }

    private List<Item> loadRangeInternal(int startPosition, int loadCount) {
        // actual load code here
    }

    @Override
    public void loadInitial(@NonNull LoadInitialParams params,
        @NonNull LoadInitialCallback<Item> callback) {
        int totalCount = computeCount();
        int position = computeInitialLoadPosition(params, totalCount);
        int loadSize = computeInitialLoadSize(params, position, totalCount);
        callback.onResult(loadRangeInternal(position, loadSize), position, totalCount);
    }

    @Override
    public void loadRange(@NonNull LoadRangeParams params,
        @NonNull LoadRangeCallback<Item> callback) {
        callback.onResult(loadRangeInternal(params.startPosition, params.loadSize));
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams params` | Params passed to `https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)`, including page size, and requested start / loadSize. |
| `int totalCount` | Total size of the data set. |

| Returns |
|---|---|
| `int` | Position to start loading at. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadSize(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int,kotlin.Int)` |   |

### computeInitialLoadSize

Added in [3.3.0](https://developer.android.com/jetpack/androidx/releases/paging#3.3.0) Deprecated in [3.3.0](https://developer.android.com/jetpack/androidx/releases/paging#3.3.0)

```
public static final int [computeInitialLoadSize](https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadSize(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int,kotlin.Int))(
    @NonNull PositionalDataSource.LoadInitialParams params,
    int initialLoadPosition,
    int totalCount
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Helper for computing an initial load size in `https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)` when total data set size can be computed ahead of loading.

This function takes the requested load size, and bounds checks it against the value returned by `https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadPosition(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int)`.

Example usage in a `https://developer.android.com/reference/androidx/paging/PositionalDataSource` subclass:

```
class ItemDataSource extends PositionalDataSource<Item> {
    private int computeCount() {
        // actual count code here
    }

    private List<Item> loadRangeInternal(int startPosition, int loadCount) {
        // actual load code here
    }

    @Override
    public void loadInitial(@NonNull LoadInitialParams params,
        @NonNull LoadInitialCallback<Item> callback) {
        int totalCount = computeCount();
        int position = computeInitialLoadPosition(params, totalCount);
        int loadSize = computeInitialLoadSize(params, position, totalCount);
        callback.onResult(loadRangeInternal(position, loadSize), position, totalCount);
    }

    @Override
    public void loadRange(@NonNull LoadRangeParams params,
        @NonNull LoadRangeCallback<Item> callback) {
        callback.onResult(loadRangeInternal(params.startPosition, params.loadSize));
    }
}
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams params` | Params passed to `https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)`, including page size, and requested start / loadSize. |
| `int initialLoadPosition` | Value returned by `https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadPosition(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int)` |
| `int totalCount` | Total size of the data set. |

| Returns |
|---|---|
| `int` | Number of items to load. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/PositionalDataSource#computeInitialLoadPosition(androidx.paging.PositionalDataSource.LoadInitialParams,kotlin.Int)` |   |

### loadInitial

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
@WorkerThread
public abstract void [loadInitial](https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams,androidx.paging.PositionalDataSource.LoadInitialCallback))(
    @NonNull PositionalDataSource.LoadInitialParams params,
    @NonNull PositionalDataSource.LoadInitialCallback<@NonNull T> callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Load initial list data.

This method is called to load the initial page(s) from the `https://developer.android.com/reference/androidx/paging/DataSource`.

LoadResult list must be a multiple of pageSize to enable efficient tiling.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialParams params` | Parameters for initial load, including requested start position, load size, and page size. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> callback` | Callback that receives initial load data, including position and total data set size. |

### loadRange

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
@WorkerThread
public abstract void [loadRange](https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadRange(androidx.paging.PositionalDataSource.LoadRangeParams,androidx.paging.PositionalDataSource.LoadRangeCallback))(
    @NonNull PositionalDataSource.LoadRangeParams params,
    @NonNull PositionalDataSource.LoadRangeCallback<@NonNull T> callback
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Called to load a range of data from the DataSource.

This method is called to load additional pages from the DataSource after the `https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadInitialCallback` passed to dispatchLoadInitial has initialized a `https://developer.android.com/reference/androidx/paging/PagedList`.

Unlike `https://developer.android.com/reference/androidx/paging/PositionalDataSource#loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams)`, this method must return the number of items requested, at the position requested.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadRangeParams params` | Parameters for load, including start position and load size. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource.LoadRangeCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> callback` | Callback that receives loaded data. |

### map

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull PositionalDataSource<@NonNull V> <V extends Object> [map](https://developer.android.com/reference/androidx/paging/PositionalDataSource#map(androidx.arch.core.util.Function))(@NonNull Function<@NonNull T, @NonNull V> function)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Applies the given function to each value emitted by the DataSource.

Same as `https://developer.android.com/reference/androidx/paging/DataSource#mapByPage(androidx.arch.core.util.Function)`, but operates on individual items.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/arch/core/util/Function<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull V> function` | Function that runs on each loaded item, returning items of a potentially new type. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | A new DataSource, which transforms items using the given function. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/DataSource#mapByPage(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#map(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#mapByPage(androidx.arch.core.util.Function)` |   |

### map

Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull PositionalDataSource<@NonNull V> <V extends Object> [map](https://developer.android.com/reference/androidx/paging/PositionalDataSource#map(kotlin.Function1))(@NonNull Function1<@NonNull T, @NonNull V> function)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Applies the given function to each value emitted by the DataSource.

An overload of `https://developer.android.com/reference/androidx/paging/DataSource#map(kotlin.Function1)` that accepts a kotlin function type.

Same as `https://developer.android.com/reference/androidx/paging/DataSource#mapByPage(androidx.arch.core.util.Function)`, but operates on individual items.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull T, @https://developer.android.com/reference/androidx/annotation/NonNull V> function` | Function that runs on each loaded item, returning items of a potentially new type. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | A new DataSource, which transforms items using the given function. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/DataSource#mapByPage(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#map(androidx.arch.core.util.Function)` |   |

### mapByPage

Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
public final @NonNull PositionalDataSource<@NonNull V> <V extends Object> [mapByPage](https://developer.android.com/reference/androidx/paging/PositionalDataSource#mapByPage(androidx.arch.core.util.Function))(
    @NonNull Function<@NonNull List<@NonNull T>, @NonNull List<@NonNull V>> function
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Applies the given function to each value emitted by the DataSource.

Same as `https://developer.android.com/reference/androidx/paging/DataSource#map(androidx.arch.core.util.Function)`, but allows for batch conversions.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/arch/core/util/Function<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull T>, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull V>> function` | Function that runs on each loaded page, returning items of a potentially new type. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | A new DataSource, which transforms items using the given function. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/DataSource#map(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#map(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#mapByPage(androidx.arch.core.util.Function)` |   |

### mapByPage

```
public final @NonNull PositionalDataSource<@NonNull V> <V extends Object> [mapByPage](https://developer.android.com/reference/androidx/paging/PositionalDataSource#mapByPage(kotlin.Function1))(
    @NonNull Function1<@NonNull List<@NonNull T>, @NonNull List<@NonNull V>> function
)
```

> [!CAUTION]
> **This method is deprecated.**   
> PositionalDataSource is deprecated and has been replaced by PagingSource, use this instead:
>
> ```
> PagingSource<Int, T>
> ```

Applies the given function to each value emitted by the DataSource.

An overload of `https://developer.android.com/reference/androidx/paging/DataSource#mapByPage(kotlin.Function1)` that accepts a kotlin function type.

Same as `https://developer.android.com/reference/androidx/paging/DataSource#map(androidx.arch.core.util.Function)`, but allows for batch conversions.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull T>, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull V>> function` | Function that runs on each loaded page, returning items of a potentially new type. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PositionalDataSource<@https://developer.android.com/reference/androidx/annotation/NonNull V>` | A new `https://developer.android.com/reference/androidx/paging/DataSource`, which transforms items using the given function. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/DataSource#map(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#map(androidx.arch.core.util.Function)` |   |
| `https://developer.android.com/reference/androidx/paging/DataSource.Factory#mapByPage(androidx.arch.core.util.Function)` |   |