Merge "Add SparseArray#set for Kotlin index= operator"
diff --git a/core/api/current.txt b/core/api/current.txt
index b6a1534..8964c9c 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -45462,6 +45462,7 @@
method public void remove(int);
method public void removeAt(int);
method public void removeAtRange(int, int);
+ method public void set(int, E);
method public void setValueAt(int, E);
method public int size();
method public E valueAt(int);
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java
index dae760f..86120d1 100644
--- a/core/java/android/util/SparseArray.java
+++ b/core/java/android/util/SparseArray.java
@@ -241,6 +241,14 @@
}
/**
+ * Alias for {@link #put(int, Object)} to support Kotlin [index]= operator.
+ * @see #put(int, Object)
+ */
+ public void set(int key, E value) {
+ put(key, value);
+ }
+
+ /**
* Adds a mapping from the specified key to the specified value,
* replacing the previous mapping from the specified key if there
* was one.