org.forester.datastructures
Class Queue

java.lang.Object
  extended by org.forester.datastructures.Queue

public class Queue
extends Object


Constructor Summary
Queue()
          This created a new, empty Queue object.
 
Method Summary
 void clear()
          Removes all elements from this queue.
 Object dequeue()
          Dequeues one element from this queue.
 void enqueue(Object element)
          Adds Object element to thisqueue.
 boolean isEmpty()
          Returns whether or not this queue is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
This created a new, empty Queue object.

Method Detail

clear

public void clear()
Removes all elements from this queue.


dequeue

public Object dequeue()
               throws NoSuchElementException
Dequeues one element from this queue.

Returns:
the dequeued object
Throws:
NoSuchElementException - if this queue is empty

enqueue

public void enqueue(Object element)
Adds Object element to thisqueue.

Parameters:
element - the Object to be enqueued

isEmpty

public boolean isEmpty()
Returns whether or not this queue is empty.

Returns:
true if this queue is empty, false otherwise