Merge "Removed warning when objects are added on wrong order." into nyc-dev

This commit is contained in:
Svetoslav Ganov
2016-06-30 23:28:58 +00:00
committed by Android (Google) Code Review

View File

@@ -402,11 +402,14 @@ public final class ArraySet<E> implements Collection<E>, Set<E> {
throw new IllegalStateException("Array is full"); throw new IllegalStateException("Array is full");
} }
if (index > 0 && mHashes[index - 1] > hash) { if (index > 0 && mHashes[index - 1] > hash) {
RuntimeException e = new RuntimeException("here"); // Cannot optimize since it would break the sorted order - fallback to add()
e.fillInStackTrace(); if (DEBUG) {
Log.w(TAG, "New hash " + hash RuntimeException e = new RuntimeException("here");
+ " is before end of array hash " + mHashes[index - 1] e.fillInStackTrace();
+ " at index " + index, e); Log.w(TAG, "New hash " + hash
+ " is before end of array hash " + mHashes[index - 1]
+ " at index " + index, e);
}
add(value); add(value);
return; return;
} }