m865.datastructures
Class QueueLL.QueueLLIterator<T>

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

public class QueueLL.QueueLLIterator<T>
extends java.lang.Object
implements java.util.Iterator<T>

An iterator for a Linked List queue.


Constructor Summary
protected QueueLL.QueueLLIterator(QueueLL<T> q)
          Constructor for a QueueLL iterator
 
Method Summary
 boolean hasNext()
          Determines if there is an object in 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

QueueLL.QueueLLIterator

protected QueueLL.QueueLLIterator(QueueLL<T> q)
Constructor for a QueueLL iterator

Parameters:
s - the queue for this iterator.
Method Detail

hasNext

public boolean hasNext()
Determines if there is an object in queue that can be returned by next().

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. Throws an UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator<T>