Archived
0

fix out of index

This commit is contained in:
iMoHax
2015-07-15 15:12:53 +03:00
parent fae9408de2
commit a658902d7b

View File

@@ -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);