Interface PriorityQueue<T extends java.lang.Comparable<? super T>>

Type Parameters:
T - the type of data the queue stores.
All Known Subinterfaces:
UpdatablePriorityQueue<T,P>

public interface PriorityQueue<T extends java.lang.Comparable<? super T>>

An interface for the Priority Queue ADT. Note that relative priority of elements is determined with the T.compareTo() method.


Method Summary
 void add(T item)
          Adds the given item to the queue.
 void clear()
          Removes all items from the queue.
 boolean isEmpty()
          Returns true if the queue is empty.
 T peek()
          Returns the maximum item in the queue, without removing it.
 T remove()
          Removes the maximum item from the queue, and returns it.
 

Method Detail

add

void add(T item)
Adds the given item to the queue.


remove

T remove()
Removes the maximum item from the queue, and returns it.

Returns:
null if the queue is empty.

peek

T peek()
Returns the maximum item in the queue, without removing it.

Returns:
null if the queue is empty.

isEmpty

boolean isEmpty()
Returns true if the queue is empty.


clear

void clear()
Removes all items from the queue.