try harder for to avoid scheduling dupes removal when adding changes: important use case is loading of the data from disk, it might be already sorted

This commit is contained in:
Maxim.Mossienko
2016-06-18 12:26:32 +02:00
parent 922d59cc2d
commit 15cc489dc5
@@ -73,9 +73,12 @@ public class ChangeBufferingList implements Cloneable {
}
private void addChange(int value) {
if (value < 0) {
if (!hasRemovals) hasRemovals = true;
} else if (!mayHaveDupes && length > 0 && changes[length - 1] >= value) {
mayHaveDupes = true;
}
changes[length++] = value;
if (value < 0 && !hasRemovals) hasRemovals = true;
if(!mayHaveDupes) mayHaveDupes = true;
}
public void remove(int value) {