diff options
| author | 2016-06-30 23:44:47 +0000 | |
|---|---|---|
| committer | 2016-06-30 23:44:47 +0000 | |
| commit | 5c9e3c6a4c85a3c18a8aeeca46d355095e07c87c (patch) | |
| tree | 6013852a36cb5e6a0c00e81ad4ff05d96c0d2d09 | |
| parent | 4e7c631aadcc57f847d28c26b22b1633fb6944c9 (diff) | |
| parent | 7524b1364284eefa2ca9f87861691fcf764a6edc (diff) | |
Merge \\"Removed warning when objects are added on wrong order.\\" into nyc-dev am: a98e4512df
am: 7524b13642
Change-Id: Ied3eaa444419fcb6b429a2101d960ba0dcba449f
| -rw-r--r-- | core/java/android/util/ArraySet.java | 13 |
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; } |