m865.datastructures
Class QueueCL.QueueCLIterator

java.lang.Object
  extended bym865.datastructures.QueueCL.QueueCLIterator
All Implemented Interfaces:
java.util.Iterator
Enclosing class:
QueueCL

public class QueueCL.QueueCLIterator
extends java.lang.Object
implements java.util.Iterator

The iterator that will walk through the elements of this queue from front to back.


Constructor Summary
protected QueueCL.QueueCLIterator(QueueCL q)
          Constructs a QueueCLIterator.
 
Method Summary
 boolean hasNext()
          Determines if there is an object in the queue that can be returned by next().
 java.lang.Object next()
          Returns the next object in queue, if there is one.
 void remove()
          This method is an optional method of the Iterator interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueCL.QueueCLIterator

protected QueueCL.QueueCLIterator(QueueCL q)
Constructs a QueueCLIterator.

Parameters:
q - the queue that the iterator will walk through.
Method Detail

hasNext

public boolean hasNext()
Determines if there is an object in the queue that can be returned by next(). It throws a ConcurrentModificationException if the queue has been changed during the iteration.

Specified by:
hasNext in interface java.util.Iterator
Returns:
true - if there is an object in the queue that can be returned by next().

next

public java.lang.Object next()
Returns the next object in queue, if there is one. It throws a ConcurrentModificationException if the queue has been changed during the iteration.

Specified by:
next in interface java.util.Iterator
Returns:
the next object in the queue.

remove

public void remove()
This method is an optional method of the Iterator interface. If implemented, it would remove from the queue the last element returned by the iterator. Since this would violate the integrity of the abstract queue data structure it is not implemented. If invoked, the method throws an UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator