Package org.openjdk.jmh.util
Class BoundedPriorityQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
org.openjdk.jmh.util.BoundedPriorityQueue<E>
- Type Parameters:
E- type of the element
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,Queue<E>
Bounded variant of
PriorityQueue.
Note: elements are returned in reverse order.
For instance, if "top N smallest elements" are required, use new BoundedPriorityQueue(N),
and the elements would be returned in largest to smallest order.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedPriorityQueue(int maxSize) Creates a bounded priority queue with the specified maximum size and default ordering.BoundedPriorityQueue(int maxSize, Comparator<? super E> comparator) Creates a bounded priority queue with the specified maximum size. -
Method Summary
Methods inherited from class java.util.AbstractQueue
addAll, clear, element, removeMethods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
BoundedPriorityQueue
public BoundedPriorityQueue(int maxSize) Creates a bounded priority queue with the specified maximum size and default ordering. At mostmaxSizesmallest elements would be kept in the queue.- Parameters:
maxSize- maximum size of the queue
-
BoundedPriorityQueue
Creates a bounded priority queue with the specified maximum size. At mostmaxSizesmallest elements would be kept in the queue.- Parameters:
maxSize- maximum size of the queuecomparator- comparator that orders the elements
-
-
Method Details
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceQueue<E>- Overrides:
addin classAbstractQueue<E>
-
offer
-
poll
-
peek
-
iterator
- Specified by:
iteratorin interfaceCollection<E>- Specified by:
iteratorin interfaceIterable<E>- Specified by:
iteratorin classAbstractCollection<E>
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein classAbstractCollection<E>
-