Class MysteryQueueImplementation<T>

java.lang.Object
  extended by MysteryQueueImplementation<T>
Type Parameters:
T - The type of data that the queue stores.
All Implemented Interfaces:
Queue<T>

public class MysteryQueueImplementation<T>
extends java.lang.Object
implements Queue<T>

An implementation of the Queue ADT.


Constructor Summary
MysteryQueueImplementation()
          Default constructor for an empty queue.
 
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.
static void main(java.lang.String[] args)
           
 T peek()
          Returns the item at the front of the queue, without removing it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MysteryQueueImplementation

public MysteryQueueImplementation()
Default constructor for an empty queue.

Method Detail

enqueue

public void enqueue(T item)
Description copied from interface: Queue
Adds the given item to the back of the queue.

Specified by:
enqueue in interface Queue<T>
Parameters:
item - the item to add

dequeue

public T dequeue()
Description copied from interface: Queue
Removes an item from the front of the queue and returns it.

Specified by:
dequeue in interface Queue<T>
Returns:
the item at the front of the queue, or null if empty

peek

public T peek()
Description copied from interface: Queue
Returns the item at the front of the queue, without removing it.

Specified by:
peek in interface Queue<T>
Returns:
the item at the front of the queue, or null if empty

isEmpty

public boolean isEmpty()
Description copied from interface: Queue
Returns true if the queue is empty.

Specified by:
isEmpty in interface Queue<T>

clear

public void clear()
Description copied from interface: Queue
Removes all items from the queue.

Specified by:
clear in interface Queue<T>

main

public static void main(java.lang.String[] args)