summaryrefslogtreecommitdiff
path: root/core/java/android/util/ArrayMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/util/ArrayMap.java')
-rw-r--r--core/java/android/util/ArrayMap.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/core/java/android/util/ArrayMap.java b/core/java/android/util/ArrayMap.java
index 51014c8dcdc5..22f62d70980a 100644
--- a/core/java/android/util/ArrayMap.java
+++ b/core/java/android/util/ArrayMap.java
@@ -247,6 +247,20 @@ public final class ArrayMap<K, V> implements Map<K, V> {
}
/**
+ * @hide
+ * Like {@link #clear}, but doesn't reduce the capacity of the ArrayMap.
+ */
+ public void erase() {
+ if (mSize > 0) {
+ final int N = mSize<<1;
+ final Object[] array = mArray;
+ for (int i=0; i<N; i++) {
+ array[i] = null;
+ }
+ }
+ }
+
+ /**
* Ensure the array map can hold at least <var>minimumCapacity</var>
* items.
*/
@@ -421,8 +435,13 @@ public final class ArrayMap<K, V> implements Map<K, V> {
throw new IllegalStateException("Array is full");
}
if (index > 0 && mHashes[index-1] > hash) {
- throw new IllegalArgumentException("New hash " + hash
- + " is before end of array hash " + mHashes[index-1]);
+ RuntimeException e = new RuntimeException("here");
+ e.fillInStackTrace();
+ Log.w(TAG, "New hash " + hash
+ + " is before end of array hash " + mHashes[index-1]
+ + " at index " + index + " key " + key, e);
+ put(key, value);
+ return;
}
mSize = index+1;
mHashes[index] = hash;