public interface IPriorityQueue<E extends Comparable<? super E>> extends IQueue<E>
| Modifier and Type | Method and Description |
|---|---|
default void |
add(E item)
Inserts the specified element into this queue,
returning true upon success.
|
default E |
element()
Retrieves, but does not remove, the head of this queue.
|
default boolean |
isEmpty()
Returns true if this queue contains no elements.
|
boolean |
offer(E e)
Inserts the specified element into this queue.
|
E |
peek()
Retrieves, but does not remove, an element of greatest priority, which
is the head of the priority queue.
|
E |
poll()
Retrieves and removes an element of greatest priority, which is
the head of the priority queue.
|
default E |
remove()
Retrieves and removes the head of this queue.
|
E poll()
poll in interface IQueue<E extends Comparable<? super E>>E peek()
peek in interface IQueue<E extends Comparable<? super E>>boolean offer(E e)
offer in interface IQueue<E extends Comparable<? super E>>e - the element to adddefault void add(E item)
IQueueThis method throws an IllegalStateException if no space is available to hold the new item.
add in interface IQueue<E extends Comparable<? super E>>item - the item to adddefault E remove()
IQueueremove in interface IQueue<E extends Comparable<? super E>>default E element()
IQueueelement in interface IQueue<E extends Comparable<? super E>>