|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface PriorityQueue<E>
A PriorityQueue is an ordered collection that supports
peek and pop methods to inspect and return the greatest element in
the queue. Iterators for priority queues return the elements
ordered from largest to smallest. Priority is typically defined by
means of a comparator.
The ordering on which a priority queue is based need not be
consistent with equals (see Comparator).
Priority queues behave like sets with respect to natural object
equality. Thus no two elements in the queue will be equal to each
other as defined by Object.equals(Object). Priority queues
behave like bags or multisets with respect to the priority ordering
of objects. Thus it is acceptable for the priority ordering Comparator.compare(Object,Object) to return 0 for
objects which are not naturally equal.
Collection,
Comparator| Method Summary | |
|---|---|
E |
peek()
Returns the largest element in the queue or null
if the queue is empty. |
E |
pop()
Remove and return the largest element in the queue or return null if the queue is empty. |
| Methods inherited from interface java.util.Collection |
|---|
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Method Detail |
|---|
E pop()
null if the queue is empty.
E peek()
null
if the queue is empty.
null
if the queue is empty.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||