fix out of index
This commit is contained in:
@@ -131,7 +131,7 @@ public class LimitedQueue<E> extends ArrayList<E> implements Queue<E> {
|
|||||||
sort();
|
sort();
|
||||||
int index = indexedBinarySearch(element, comparator);
|
int index = indexedBinarySearch(element, comparator);
|
||||||
if (index < 0) index = -1 - index;
|
if (index < 0) index = -1 - index;
|
||||||
if (index == limit || element.equals(super.get(index))) return false;
|
if (index == limit || index < size && element.equals(super.get(index))) return false;
|
||||||
super.add(index, element);
|
super.add(index, element);
|
||||||
if (size == limit)
|
if (size == limit)
|
||||||
super.remove(limit);
|
super.remove(limit);
|
||||||
|
|||||||
Reference in New Issue
Block a user