Add SparseArray#set for Kotlin index= operator

Just an alias for put to allow `array[index] = value` syntax in Kotlin.

Bug: 163565712

Test: manual, used in tests for separate feature

Change-Id: Ie9e17b8f4d16a52f4dc213e1ada8d61fce9eedaf
This commit is contained in:
Winson
2021-01-11 17:06:18 -08:00
parent 565151c564
commit 590e9ffb4c
2 changed files with 9 additions and 0 deletions

View File

@@ -45372,6 +45372,7 @@ package android.util {
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);

View File

@@ -240,6 +240,14 @@ public class SparseArray<E> implements Cloneable {
// Log.e("SparseArray", "gc end with " + mSize);
}
/**
* 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