Add kotlin function type overloads for map / mapBy

Test: ./gradlew paging:paging-common:check
Change-Id: I4b0534d73725ff12cf05437fe62f4797419324f1
diff --git a/paging/common/api/2.2.0-alpha01.txt b/paging/common/api/2.2.0-alpha01.txt
index 1b5b1fa..9fd763e 100644
--- a/paging/common/api/2.2.0-alpha01.txt
+++ b/paging/common/api/2.2.0-alpha01.txt
@@ -9,7 +9,9 @@
     method @WorkerThread public boolean isInvalid();
     method public boolean isRetryableError(Throwable error);
     method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
     method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
     method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
     property protected final java.util.concurrent.Executor executor;
@@ -31,7 +33,9 @@
     ctor public DataSource.Factory();
     method public abstract androidx.paging.DataSource<Key,Value> create();
     method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
   }
 
   public static interface DataSource.InvalidatedCallback {
@@ -49,7 +53,9 @@
     method public abstract void loadBefore(androidx.paging.ItemKeyedDataSource.LoadParams<Key> params, androidx.paging.ItemKeyedDataSource.LoadCallback<Value> callback);
     method public abstract void loadInitial(androidx.paging.ItemKeyedDataSource.LoadInitialParams<Key> params, androidx.paging.ItemKeyedDataSource.LoadInitialCallback<Value> callback);
     method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
   }
 
   public abstract static class ItemKeyedDataSource.LoadCallback<Value> {
@@ -144,7 +150,9 @@
     method public final com.google.common.util.concurrent.ListenableFuture<androidx.paging.ListenablePageKeyedDataSource.InitialResult<Key,Value>> loadInitial(androidx.paging.ListenablePageKeyedDataSource.LoadInitialParams<Key> params);
     method public abstract void loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams<Key> params, androidx.paging.PageKeyedDataSource.LoadInitialCallback<Key,Value> callback);
     method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
   }
 
   public abstract static class PageKeyedDataSource.LoadCallback<Key, Value> {
@@ -347,7 +355,9 @@
     method public final com.google.common.util.concurrent.ListenableFuture<androidx.paging.ListenablePositionalDataSource.RangeResult<T>> loadRange(androidx.paging.ListenablePositionalDataSource.LoadRangeParams params);
     method @WorkerThread public abstract void loadRange(androidx.paging.PositionalDataSource.LoadRangeParams params, androidx.paging.PositionalDataSource.LoadRangeCallback<T> callback);
     method public final <V> androidx.paging.PositionalDataSource<V> map(androidx.arch.core.util.Function<T,V> function);
+    method public final <V> androidx.paging.PositionalDataSource<V> map(kotlin.jvm.functions.Function1<? super T,? extends V> function);
     method public final <V> androidx.paging.PositionalDataSource<V> mapByPage(androidx.arch.core.util.Function<java.util.List<T>,java.util.List<V>> function);
+    method public final <V> androidx.paging.PositionalDataSource<V> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends T>,? extends java.util.List<? extends V>> function);
   }
 
   public abstract static class PositionalDataSource.LoadInitialCallback<T> {
diff --git a/paging/common/api/current.txt b/paging/common/api/current.txt
index 1b5b1fa..9fd763e 100644
--- a/paging/common/api/current.txt
+++ b/paging/common/api/current.txt
@@ -9,7 +9,9 @@
     method @WorkerThread public boolean isInvalid();
     method public boolean isRetryableError(Throwable error);
     method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
     method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
     method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
     property protected final java.util.concurrent.Executor executor;
@@ -31,7 +33,9 @@
     ctor public DataSource.Factory();
     method public abstract androidx.paging.DataSource<Key,Value> create();
     method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
   }
 
   public static interface DataSource.InvalidatedCallback {
@@ -49,7 +53,9 @@
     method public abstract void loadBefore(androidx.paging.ItemKeyedDataSource.LoadParams<Key> params, androidx.paging.ItemKeyedDataSource.LoadCallback<Value> callback);
     method public abstract void loadInitial(androidx.paging.ItemKeyedDataSource.LoadInitialParams<Key> params, androidx.paging.ItemKeyedDataSource.LoadInitialCallback<Value> callback);
     method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
   }
 
   public abstract static class ItemKeyedDataSource.LoadCallback<Value> {
@@ -144,7 +150,9 @@
     method public final com.google.common.util.concurrent.ListenableFuture<androidx.paging.ListenablePageKeyedDataSource.InitialResult<Key,Value>> loadInitial(androidx.paging.ListenablePageKeyedDataSource.LoadInitialParams<Key> params);
     method public abstract void loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams<Key> params, androidx.paging.PageKeyedDataSource.LoadInitialCallback<Key,Value> callback);
     method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
+    method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
     method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
+    method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
   }
 
   public abstract static class PageKeyedDataSource.LoadCallback<Key, Value> {
@@ -347,7 +355,9 @@
     method public final com.google.common.util.concurrent.ListenableFuture<androidx.paging.ListenablePositionalDataSource.RangeResult<T>> loadRange(androidx.paging.ListenablePositionalDataSource.LoadRangeParams params);
     method @WorkerThread public abstract void loadRange(androidx.paging.PositionalDataSource.LoadRangeParams params, androidx.paging.PositionalDataSource.LoadRangeCallback<T> callback);
     method public final <V> androidx.paging.PositionalDataSource<V> map(androidx.arch.core.util.Function<T,V> function);
+    method public final <V> androidx.paging.PositionalDataSource<V> map(kotlin.jvm.functions.Function1<? super T,? extends V> function);
     method public final <V> androidx.paging.PositionalDataSource<V> mapByPage(androidx.arch.core.util.Function<java.util.List<T>,java.util.List<V>> function);
+    method public final <V> androidx.paging.PositionalDataSource<V> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends T>,? extends java.util.List<? extends V>> function);
   }
 
   public abstract static class PositionalDataSource.LoadInitialCallback<T> {
diff --git a/paging/common/src/main/kotlin/androidx/paging/DataSource.kt b/paging/common/src/main/kotlin/androidx/paging/DataSource.kt
index 8a9c9fc..afe3a99 100644
--- a/paging/common/src/main/kotlin/androidx/paging/DataSource.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/DataSource.kt
@@ -177,7 +177,7 @@
          * Same as [mapByPage], but operates on individual items.
          *
          * @param function Function that runs on each loaded item, returning items of a potentially
-         *                 new type.
+         * new type.
          * @param ToValue Type of items produced by the new DataSource, from the passed function.
          * @return A new [DataSource.Factory], which transforms items using the given function.
          *
@@ -191,10 +191,29 @@
         /**
          * Applies the given function to each value emitted by DataSources produced by this Factory.
          *
+         * An overload of [map] that accepts a kotlin function type.
+         *
+         * Same as [mapByPage], but operates on individual items.
+         *
+         * @param function Function that runs on each loaded item, returning items of a potentially
+         * new type.
+         * @param ToValue Type of items produced by the new DataSource, from the passed function.
+         * @return A new [DataSource.Factory], which transforms items using the given function.
+         *
+         * @see mapByPage
+         * @see DataSource.map
+         * @see DataSource.mapByPage
+         */
+        open fun <ToValue : Any> map(function: (Value) -> ToValue): Factory<Key, ToValue> =
+            mapByPage(Function { list -> list.map(function) })
+
+        /**
+         * Applies the given function to each value emitted by DataSources produced by this Factory.
+         *
          * Same as [map], but allows for batch conversions.
          *
          * @param function Function that runs on each loaded page, returning items of a potentially
-         *                 new type.
+         * new type.
          * @param ToValue Type of items produced by the new DataSource, from the passed function.
          * @return A new [DataSource.Factory], which transforms items using the given function.
          *
@@ -208,6 +227,26 @@
             override fun create(): DataSource<Key, ToValue> =
                 [email protected]().mapByPage(function)
         }
+
+        /**
+         * Applies the given function to each value emitted by DataSources produced by this Factory.
+         *
+         * An overload of [mapByPage] that accepts a kotlin function type.
+         *
+         * Same as [map], but allows for batch conversions.
+         *
+         * @param function Function that runs on each loaded page, returning items of a potentially
+         * new type.
+         * @param ToValue Type of items produced by the new DataSource, from the passed function.
+         * @return A new [DataSource.Factory], which transforms items using the given function.
+         *
+         * @see map
+         * @see DataSource.map
+         * @see DataSource.mapByPage
+         */
+        open fun <ToValue : Any> mapByPage(
+            function: (List<Value>) -> List<ToValue>
+        ): Factory<Key, ToValue> = mapByPage(Function { function(it) })
     }
 
     /**
@@ -216,7 +255,7 @@
      * Same as [map], but allows for batch conversions.
      *
      * @param function Function that runs on each loaded page, returning items of a potentially
-     *                 new type.
+     * new type.
      * @param ToValue Type of items produced by the new DataSource, from the passed function.
      * @return A new DataSource, which transforms items using the given function.
      *
@@ -231,10 +270,30 @@
     /**
      * Applies the given function to each value emitted by the DataSource.
      *
+     * An overload of [mapByPage] that accepts a kotlin function type.
+     *
+     * Same as [map], but allows for batch conversions.
+     *
+     * @param function Function that runs on each loaded page, returning items of a potentially
+     * new type.
+     * @param ToValue Type of items produced by the new DataSource, from the passed function.
+     * @return A new DataSource, which transforms items using the given function.
+     *
+     * @see map
+     * @see DataSource.Factory.map
+     * @see DataSource.Factory.mapByPage
+     */
+    open fun <ToValue : Any> mapByPage(
+        function: (List<Value>) -> List<ToValue>
+    ): DataSource<Key, ToValue> = mapByPage(Function { function(it) })
+
+    /**
+     * Applies the given function to each value emitted by the DataSource.
+     *
      * Same as [mapByPage], but operates on individual items.
      *
      * @param function Function that runs on each loaded item, returning items of a potentially
-     *                 new type.
+     * new type.
      * @param ToValue Type of items produced by the new DataSource, from the passed function.
      * @return A new DataSource, which transforms items using the given function.
      *
@@ -243,7 +302,27 @@
      * @see DataSource.Factory.mapByPage
      */
     open fun <ToValue : Any> map(function: Function<Value, ToValue>): DataSource<Key, ToValue> =
-        mapByPage(Function { list -> list.map { function.apply(it) } })
+        mapByPage { list -> list.map { function.apply(it) } }
+
+    /**
+     * Applies the given function to each value emitted by the DataSource.
+     *
+     * An overload of [map] that accepts a kotlin function type.
+     *
+     * Same as [mapByPage], but operates on individual items.
+     *
+     * @param function Function that runs on each loaded item, returning items of a potentially
+     * new type.
+     * @param ToValue Type of items produced by the new DataSource, from the passed function.
+     * @return A new DataSource, which transforms items using the given function.
+     *
+     * @see mapByPage
+     * @see DataSource.Factory.map
+     *
+     */
+    open fun <ToValue : Any> map(
+        function: (Value) -> ToValue
+    ): DataSource<Key, ToValue> = map(Function { function(it) })
 
     /**
      * Returns true if the data source guaranteed to produce a contiguous set of items, never
diff --git a/paging/common/src/main/kotlin/androidx/paging/ItemKeyedDataSource.kt b/paging/common/src/main/kotlin/androidx/paging/ItemKeyedDataSource.kt
index 98feb50..33c2342 100644
--- a/paging/common/src/main/kotlin/androidx/paging/ItemKeyedDataSource.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/ItemKeyedDataSource.kt
@@ -368,8 +368,16 @@
         function: Function<List<Value>, List<ToValue>>
     ): ItemKeyedDataSource<Key, ToValue> = WrapperItemKeyedDataSource(this, function)
 
+    final override fun <ToValue : Any> mapByPage(
+        function: (List<Value>) -> List<ToValue>
+    ): ItemKeyedDataSource<Key, ToValue> = mapByPage(Function { function(it) })
+
     final override fun <ToValue : Any> map(
         function: Function<Value, ToValue>
     ): ItemKeyedDataSource<Key, ToValue> =
         mapByPage(Function { list -> list.map { function.apply(it) } })
+
+    final override fun <ToValue : Any> map(
+        function: (Value) -> ToValue
+    ): ItemKeyedDataSource<Key, ToValue> = mapByPage(Function { list -> list.map(function) })
 }
diff --git a/paging/common/src/main/kotlin/androidx/paging/PageKeyedDataSource.kt b/paging/common/src/main/kotlin/androidx/paging/PageKeyedDataSource.kt
index ad41ea0..ee6a847 100644
--- a/paging/common/src/main/kotlin/androidx/paging/PageKeyedDataSource.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/PageKeyedDataSource.kt
@@ -315,8 +315,16 @@
         function: Function<List<Value>, List<ToValue>>
     ): PageKeyedDataSource<Key, ToValue> = WrapperPageKeyedDataSource(this, function)
 
+    final override fun <ToValue : Any> mapByPage(
+        function: (List<Value>) -> List<ToValue>
+    ): PageKeyedDataSource<Key, ToValue> = mapByPage(Function { function(it) })
+
     final override fun <ToValue : Any> map(
         function: Function<Value, ToValue>
     ): PageKeyedDataSource<Key, ToValue> =
         mapByPage(Function { list -> list.map { function.apply(it) } })
+
+    final override fun <ToValue : Any> map(
+        function: (Value) -> ToValue
+    ): PageKeyedDataSource<Key, ToValue> = mapByPage(Function { list -> list.map(function) })
 }
diff --git a/paging/common/src/main/kotlin/androidx/paging/PositionalDataSource.kt b/paging/common/src/main/kotlin/androidx/paging/PositionalDataSource.kt
index 50bb351..5e97a4d 100644
--- a/paging/common/src/main/kotlin/androidx/paging/PositionalDataSource.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/PositionalDataSource.kt
@@ -384,6 +384,13 @@
         function: Function<List<T>, List<V>>
     ): PositionalDataSource<V> = WrapperPositionalDataSource(this, function)
 
+    final override fun <V : Any> mapByPage(
+        function: (List<T>) -> List<V>
+    ): PositionalDataSource<V> = mapByPage(Function { function(it) })
+
     final override fun <V : Any> map(function: Function<T, V>): PositionalDataSource<V> =
         mapByPage(Function { list -> list.map { function.apply(it) } })
+
+    final override fun <V : Any> map(function: (T) -> V): PositionalDataSource<V> =
+        mapByPage(Function { list -> list.map(function) })
 }
diff --git a/paging/common/src/main/kotlin/androidx/paging/WrapperDataSource.kt b/paging/common/src/main/kotlin/androidx/paging/WrapperDataSource.kt
index 263ce13..696285b 100644
--- a/paging/common/src/main/kotlin/androidx/paging/WrapperDataSource.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/WrapperDataSource.kt
@@ -29,8 +29,7 @@
  */
 internal open class WrapperDataSource<Key : Any, ValueFrom : Any, ValueTo : Any>(
     private val source: DataSource<Key, ValueFrom>,
-    @SuppressWarnings("WeakerAccess") /* synthetic access */
-    val listFunction: Function<List<ValueFrom>, List<ValueTo>>
+    private val listFunction: Function<List<ValueFrom>, List<ValueTo>>
 ) : DataSource<Key, ValueTo>(source.type) {
     private val keyMap = when (source.type) {
         KeyType.ITEM_KEYED -> IdentityHashMap<ValueTo, Key>()
diff --git a/paging/common/src/test/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt b/paging/common/src/test/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt
index 819d9db..3212589 100644
--- a/paging/common/src/test/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt
+++ b/paging/common/src/test/kotlin/androidx/paging/ItemKeyedDataSourceTest.kt
@@ -16,7 +16,6 @@
 
 package androidx.paging
 
-import androidx.arch.core.util.Function
 import androidx.paging.futures.DirectExecutor
 import com.nhaarman.mockitokotlin2.capture
 import com.nhaarman.mockitokotlin2.mock
@@ -494,18 +493,18 @@
 
     @Test
     fun testListConverterWrappedDataSource() = verifyWrappedDataSource { dataSource ->
-        dataSource.mapByPage(Function { page -> page.map { DecoratedItem(it) } })
+        dataSource.mapByPage { page -> page.map { DecoratedItem(it) } }
     }
 
     @Test
     fun testItemConverterWrappedDataSource() = verifyWrappedDataSource { dataSource ->
-        dataSource.map(Function { DecoratedItem(it) })
+        dataSource.map { DecoratedItem(it) }
     }
 
     @Test
     fun testInvalidateToWrapper() {
         val orig = ItemDataSource()
-        val wrapper = orig.map<DecoratedItem>(Function { DecoratedItem(it) })
+        val wrapper = orig.map { DecoratedItem(it) }
 
         orig.invalidate()
         assertTrue(wrapper.isInvalid)
@@ -514,7 +513,7 @@
     @Test
     fun testInvalidateFromWrapper() {
         val orig = ItemDataSource()
-        val wrapper = orig.map<DecoratedItem>(Function { DecoratedItem(it) })
+        val wrapper = orig.map { DecoratedItem(it) }
 
         wrapper.invalidate()
         assertTrue(orig.isInvalid)
diff --git a/paging/common/src/test/kotlin/androidx/paging/PageKeyedDataSourceTest.kt b/paging/common/src/test/kotlin/androidx/paging/PageKeyedDataSourceTest.kt
index 63d3b28..ccc1bd0 100644
--- a/paging/common/src/test/kotlin/androidx/paging/PageKeyedDataSourceTest.kt
+++ b/paging/common/src/test/kotlin/androidx/paging/PageKeyedDataSourceTest.kt
@@ -16,7 +16,6 @@
 
 package androidx.paging
 
-import androidx.arch.core.util.Function
 import androidx.paging.futures.DirectExecutor
 import androidx.testutils.TestExecutor
 import org.junit.Assert.assertEquals
@@ -459,18 +458,18 @@
 
     @Test
     fun testListConverterWrappedDataSource() = verifyWrappedDataSource { dataSource ->
-        dataSource.mapByPage(Function { page -> page.map { it.toString() } })
+        dataSource.mapByPage { page -> page.map { it.toString() } }
     }
 
     @Test
     fun testItemConverterWrappedDataSource() = verifyWrappedDataSource { dataSource ->
-        dataSource.map(Function { it.toString() })
+        dataSource.map { it.toString() }
     }
 
     @Test
     fun testInvalidateToWrapper() {
         val orig = ItemDataSource()
-        val wrapper = orig.map<String>(Function { it.toString() })
+        val wrapper = orig.map { it.toString() }
 
         orig.invalidate()
         assertTrue(wrapper.isInvalid)
@@ -479,7 +478,7 @@
     @Test
     fun testInvalidateFromWrapper() {
         val orig = ItemDataSource()
-        val wrapper = orig.map<String>(Function { it.toString() })
+        val wrapper = orig.map { it.toString() }
 
         wrapper.invalidate()
         assertTrue(orig.isInvalid)
diff --git a/paging/common/src/test/kotlin/androidx/paging/PositionalDataSourceTest.kt b/paging/common/src/test/kotlin/androidx/paging/PositionalDataSourceTest.kt
index 55ebbad..00fd661 100644
--- a/paging/common/src/test/kotlin/androidx/paging/PositionalDataSourceTest.kt
+++ b/paging/common/src/test/kotlin/androidx/paging/PositionalDataSourceTest.kt
@@ -16,7 +16,6 @@
 
 package androidx.paging
 
-import androidx.arch.core.util.Function
 import androidx.paging.futures.DirectExecutor
 import org.junit.Assert.assertEquals
 import org.junit.Assert.assertTrue
@@ -401,18 +400,18 @@
 
     @Test
     fun testListConverterWrappedDataSource() = verifyWrappedDataSource { dataSource ->
-        dataSource.mapByPage(Function { page -> page.map { it.toString() } })
+        dataSource.mapByPage { page -> page.map { it.toString() } }
     }
 
     @Test
     fun testItemConverterWrappedDataSource() = verifyWrappedDataSource { dataSource ->
-        dataSource.map(Function { it.toString() })
+        dataSource.map { it.toString() }
     }
 
     @Test
     fun testInvalidateToWrapper() {
         val orig = ListDataSource(listOf(0, 1, 2))
-        val wrapper = orig.map<String>(Function { it.toString() })
+        val wrapper = orig.map { it.toString() }
 
         orig.invalidate()
         assertTrue(wrapper.isInvalid)
@@ -421,7 +420,7 @@
     @Test
     fun testInvalidateFromWrapper() {
         val orig = ListDataSource(listOf(0, 1, 2))
-        val wrapper = orig.map<String>(Function { it.toString() })
+        val wrapper = orig.map { it.toString() }
 
         wrapper.invalidate()
         assertTrue(orig.isInvalid)