classlib: small PriorityQueue fixes (#823)

This commit is contained in:
Ivan Hetman 2023-10-16 14:59:35 +03:00 committed by GitHub
parent 1900852cd8
commit 65681e74d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,8 +48,8 @@ public class TPriorityQueue<E> extends TAbstractQueue<E> implements TSerializabl
initFromSortedSet((TSortedSet<? extends E>) c);
} else {
data = new Object[c.size()];
fillFromCollection(c);
setComparator(null);
fillFromCollection(c);
}
}
@ -170,6 +170,9 @@ public class TPriorityQueue<E> extends TAbstractQueue<E> implements TSerializabl
if (version != knownVersion) {
throw new TConcurrentModificationException();
}
if (index >= size) {
throw new TNoSuchElementException();
}
removeIndex = index;
return (E) data[index++];
}