net.datastructures - version 5.0

net.datastructures
Class ElementIterator<E>

java.lang.Object
  extended by net.datastructures.ElementIterator<E>
All Implemented Interfaces:
Iterator<E>

public class ElementIterator<E>
extends Object
implements Iterator<E>

A simple iterator class for lists. The elements of a list are returned by this iterator. No copy of the list is made, so any changes to the list are reflected in the iterator.

Author:
Michael Goodrich, Eric Zamore, Roberto Tamassia

Field Summary
protected  Position<E> cursor
           
protected  PositionList<E> list
           
 
Constructor Summary
ElementIterator(PositionList<E> L)
          Creates an element iterator over the given list.
 
Method Summary
 boolean hasNext()
          Returns whether the iterator has a next object.
 E next()
          Returns the next object in the iterator.
 void remove()
          Throws an UnsupportedOperationException in all cases, because removal is not a supported operation in this iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

list

protected PositionList<E> list

cursor

protected Position<E> cursor
Constructor Detail

ElementIterator

public ElementIterator(PositionList<E> L)
Creates an element iterator over the given list.

Method Detail

hasNext

public boolean hasNext()
Returns whether the iterator has a next object.

Specified by:
hasNext in interface Iterator<E>

next

public E next()
       throws NoSuchElementException
Returns the next object in the iterator.

Specified by:
next in interface Iterator<E>
Throws:
NoSuchElementException

remove

public void remove()
            throws UnsupportedOperationException
Throws an UnsupportedOperationException in all cases, because removal is not a supported operation in this iterator.

Specified by:
remove in interface Iterator<E>
Throws:
UnsupportedOperationException

net.datastructures - version 5.0