Loading core/api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -2709,7 +2709,7 @@ package android.util { public class SparseArrayMap<K, V> { ctor public SparseArrayMap(); method public void add(int, @NonNull K, @Nullable V); method public V add(int, @NonNull K, @Nullable V); method public void clear(); method public boolean contains(int, @NonNull K); method public void delete(int); Loading core/java/android/util/SparseArrayMap.java +9 −3 Original line number Diff line number Diff line Loading @@ -34,14 +34,20 @@ import java.util.function.Consumer; public class SparseArrayMap<K, V> { private final SparseArray<ArrayMap<K, V>> mData = new SparseArray<>(); /** Add an entry associating obj with the int-K pair. */ public void add(int key, @NonNull K mapKey, @Nullable V obj) { /** * Add an entry associating obj with the int-K pair. * * @return the previous value associated with key, or null if there was no mapping for key. * (A null return can also indicate that the map previously associated null with key, if the * implementation supports null values.) */ public V add(int key, @NonNull K mapKey, @Nullable V obj) { ArrayMap<K, V> data = mData.get(key); if (data == null) { data = new ArrayMap<>(); mData.put(key, data); } data.put(mapKey, obj); return data.put(mapKey, obj); } /** Remove all entries from the map. */ Loading Loading
core/api/test-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -2709,7 +2709,7 @@ package android.util { public class SparseArrayMap<K, V> { ctor public SparseArrayMap(); method public void add(int, @NonNull K, @Nullable V); method public V add(int, @NonNull K, @Nullable V); method public void clear(); method public boolean contains(int, @NonNull K); method public void delete(int); Loading
core/java/android/util/SparseArrayMap.java +9 −3 Original line number Diff line number Diff line Loading @@ -34,14 +34,20 @@ import java.util.function.Consumer; public class SparseArrayMap<K, V> { private final SparseArray<ArrayMap<K, V>> mData = new SparseArray<>(); /** Add an entry associating obj with the int-K pair. */ public void add(int key, @NonNull K mapKey, @Nullable V obj) { /** * Add an entry associating obj with the int-K pair. * * @return the previous value associated with key, or null if there was no mapping for key. * (A null return can also indicate that the map previously associated null with key, if the * implementation supports null values.) */ public V add(int key, @NonNull K mapKey, @Nullable V obj) { ArrayMap<K, V> data = mData.get(key); if (data == null) { data = new ArrayMap<>(); mData.put(key, data); } data.put(mapKey, obj); return data.put(mapKey, obj); } /** Remove all entries from the map. */ Loading