datastructures

net.datastructures
Class PositionIterator

java.lang.Object
  extended bynet.datastructures.PositionIterator
All Implemented Interfaces:
Iterator

public class PositionIterator
extends Object
implements Iterator

A simple iterator class for lists. The positions 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

Field Summary
protected  Position cur
           
protected  List list
           
 
Constructor Summary
PositionIterator()
           
PositionIterator(List L)
          Creates an iterator over the given list.
 
Method Summary
 boolean hasNext()
          Returns whether the iterator has a next object.
 Object 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 List list

cur

protected Position cur
Constructor Detail

PositionIterator

public PositionIterator()

PositionIterator

public PositionIterator(List L)
Creates an 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

next

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

Specified by:
next in interface Iterator
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
Throws:
UnsupportedOperationException

datastructures