Convert Function to Kotlin

By converting androidx.core.util.Function to
Kotlin, we ensure that the nullability of
the input and output of the Function match
the generics on the type.

Test: ./gradlew checkApi
Relnote: "`androidx.core.util.Function` has been
rewritten in Kotlin, ensuring that the nullability
of the input and outputs of the function match
the generic types used."

Change-Id: I09dd7d5c40ec90dae252e7befa22e557263a14ec
diff --git a/core/core/api/current.txt b/core/core/api/current.txt
index d7001c1..68736e1 100644
--- a/core/core/api/current.txt
+++ b/core/core/api/current.txt
@@ -2353,8 +2353,8 @@
     method public void accept(T!);
   }
 
-  @java.lang.FunctionalInterface public interface Function<T, R> {
-    method public R! apply(T!);
+  public fun interface Function<T, R> {
+    method public R apply(T value);
   }
 
   public class ObjectsCompat {
diff --git a/core/core/api/restricted_current.txt b/core/core/api/restricted_current.txt
index b75e2bb..0878243 100644
--- a/core/core/api/restricted_current.txt
+++ b/core/core/api/restricted_current.txt
@@ -2740,8 +2740,8 @@
     method public static void buildShortClassTag(Object!, StringBuilder!);
   }
 
-  @java.lang.FunctionalInterface public interface Function<T, R> {
-    method public R! apply(T!);
+  public fun interface Function<T, R> {
+    method public R apply(T value);
   }
 
   @Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public class LogWriter extends java.io.Writer {
diff --git a/core/core/src/main/java/androidx/core/util/Function.kt b/core/core/src/main/java/androidx/core/util/Function.kt
index 682c961..04011c3 100644
--- a/core/core/src/main/java/androidx/core/util/Function.kt
+++ b/core/core/src/main/java/androidx/core/util/Function.kt
@@ -13,20 +13,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package androidx.core.util;
+package androidx.core.util
 
 /**
- * Compat version of {@link java.util.function.Function}
- * @param <T> the type of the input to the operation
- * @param <R>: the type of the output of the function
+ * Compat version of [java.util.function.Function]
+ * @param T the type of the input to the operation
+ * @param R the type of the output of the function
  */
-@FunctionalInterface
-public interface Function<T, R> {
+fun interface Function<T, R> {
     /**
      * Applies the function to the argument parameter.
      *
-     * @param t the argument for the function
+     * @param value the argument for the function
      * @return the result after applying function
      */
-    R apply(T t);
+    fun apply(value: T): R
 }