m865.datastructures
Class QueueCL.QueueCLIterator<T>

java.lang.Object
  extended by m865.datastructures.QueueCL.QueueCLIterator<T>
All Implemented Interfaces:
java.util.Iterator<T>
Enclosing class:
QueueCL<T>

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

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().
 T 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<T>
Returns:
true - if there is an object in the queue that can be returned by next().

next

public T 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<T>
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<T>