summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Felipe Leme <felipeal@google.com> 2016-06-30 23:37:13 +0000
committer android-build-merger <android-build-merger@google.com> 2016-06-30 23:37:13 +0000
commit620936768f6c6d0ea2296d1653e7fc84115639b4 (patch)
treee2d7a132b7064f7ce248d4389c2f7c5fd96e1ab5
parent526dba474a88791ed5efe7bb4884a69d6cbb778e (diff)
parenta98e4512dfc00ebb5183451e14af313add96f668 (diff)
Merge \"Removed warning when objects are added on wrong order.\" into nyc-dev
am: a98e4512df Change-Id: Ibfa5a20731caae48c7961ab0452a72d7bff34cf0
-rw-r--r--core/java/android/util/ArraySet.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/java/android/util/ArraySet.java b/core/java/android/util/ArraySet.java
index d39e91fd98b2..1e765b62e131 100644
--- a/core/java/android/util/ArraySet.java
+++ b/core/java/android/util/ArraySet.java
@@ -402,11 +402,14 @@ public final class ArraySet<E> implements Collection<E>, Set<E> {
throw new IllegalStateException("Array is full");
}
if (index > 0 && mHashes[index - 1] > hash) {
- 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, e);
+ // Cannot optimize since it would break the sorted order - fallback to add()
+ if (DEBUG) {
+ 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, e);
+ }
add(value);
return;
}