T - Type of objects stored in the queuepublic class InvertedPriorityQueue<T> extends PriorityQueue<T>
PriorityQueue implementation, where
objects that are higher (according to the provided Comparator or the
natural order) come first.
The Iterator provided in method PriorityQueue.iterator() is not
guaranteed to traverse the elements of the priority queue in any particular
order.
| Constructor and Description |
|---|
InvertedPriorityQueue()
Creates a
InvertedPriorityQueue with the default initial capacity
(11) that orders its elements according to their inverted
natural ordering. |
InvertedPriorityQueue(int initialCapacity)
Creates a
InvertedPriorityQueue with the specified initial
capacity that orders its elements according to their inverse
natural ordering. |
InvertedPriorityQueue(int initialCapacity,
Comparator<? super T> comparator)
Creates a
InvertedPriorityQueue with the specified initial
capacity that orders its elements according to the inverse of the
specified comparator. |
| Modifier and Type | Method and Description |
|---|---|
protected Comparator<? super T> |
originalComparator() |
add, clear, comparator, contains, iterator, offer, peek, poll, remove, size, spliterator, toArray, toArrayaddAll, element, removecontainsAll, isEmpty, removeAll, retainAll, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, streampublic InvertedPriorityQueue()
InvertedPriorityQueue with the default initial capacity
(11) that orders its elements according to their inverted
natural ordering.public InvertedPriorityQueue(int initialCapacity, Comparator<? super T> comparator)
InvertedPriorityQueue with the specified initial
capacity that orders its elements according to the inverse of the
specified comparator.initialCapacity - the initial capacity for this priority queuecomparator - the comparator that will be used to order this priority queue.
If null, the natural ordering
of the elements will be used. Internally, the comparator is
inverted to reverse its meaning.IllegalArgumentException - if initialCapacity is less than 1public InvertedPriorityQueue(int initialCapacity)
InvertedPriorityQueue with the specified initial
capacity that orders its elements according to their inverse
natural ordering.initialCapacity - the initial capacity for this priority queueIllegalArgumentException - if initialCapacity is less than 1protected Comparator<? super T> originalComparator()