Interface Queue<T>

Type Parameters:
T - The type of data that the queue stores.
All Known Implementing Classes:
MysteryQueueImplementation

public interface Queue<T>

An interface for the Queue ADT.


Method Summary
 void clear()
          Removes all items from the queue.
 T dequeue()
          Removes an item from the front of the queue and returns it.
 void enqueue(T item)
          Adds the given item to the back of the queue.
 boolean isEmpty()
          Returns true if the queue is empty.
 T peek()
          Returns the item at the front of the queue, without removing it.
 

Method Detail

enqueue

void enqueue(T item)
Adds the given item to the back of the queue.

Parameters:
item - the item to add

dequeue

T dequeue()
Removes an item from the front of the queue and returns it.

Returns:
the item at the front of the queue, or null if empty

peek

T peek()
Returns the item at the front of the queue, without removing it.

Returns:
the item at the front of the queue, or null if empty

isEmpty

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


clear

void clear()
Removes all items from the queue.