Advertisement
Flameancer

PriorityQueue.java

May 29th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public interface PriorityQueue<T extends Comparable<? super T>> {
  2.  
  3.     /** Adds the given item to the queue. */
  4.     public void add(T item);
  5.  
  6.     /** Removes the first item according to compareTo from the queue, and returns it.
  7.      * @return null if the queue is empty.
  8.      */
  9.     public T poll();
  10.  
  11.     /** Returns the first item according to compareTo in the queue, without removing it.
  12.      * @return null if the queue is empty.
  13.      */
  14.     public T peek();
  15.  
  16.     /** Returns true if the queue is empty. */
  17.     public boolean isEmpty();
  18.  
  19.     /** Removes all items from the queue. */
  20.     public void clear();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement