structure
Class ArrayIterator

java.lang.Object
  extended by structure.AbstractIterator
      extended by structure.ArrayIterator
All Implemented Interfaces:
Enumeration, Iterator

public class ArrayIterator
extends AbstractIterator


Constructor Summary
ArrayIterator(Object[] source)
           
ArrayIterator(Object[] source, int first, int size)
           
 
Method Summary
 Object get()
          Returns the value currently being considered by the AbstractIterator.
 boolean hasNext()
          Returns true if the iterator has more elements to visit.
 Object next()
          Moves, bumps, or "increments" the iterator along the traversal; returns the next value considered.
 void reset()
          Reset iterator to the beginning of the structure.
 
Methods inherited from class structure.AbstractIterator
hasMoreElements, nextElement, remove, value
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayIterator

public ArrayIterator(Object[] source)

ArrayIterator

public ArrayIterator(Object[] source,
                     int first,
                     int size)
Method Detail

reset

public void reset()
Description copied from class: AbstractIterator
Reset iterator to the beginning of the structure. This method is not required of Iterator or Enumeration implementation, but some traversals may allow efficient multi-pass implementations with little overhead. The user is encouraged to implement this method.

Specified by:
reset in class AbstractIterator

hasNext

public boolean hasNext()
Description copied from class: AbstractIterator
Returns true if the iterator has more elements to visit. The method hasMoreElements is an Enumeration-required call to this method. The user should override only this method.

Specified by:
hasNext in interface Iterator
Specified by:
hasNext in class AbstractIterator
Returns:
true iff the iterator has more elements to visit
See Also:
AbstractIterator.hasMoreElements()

next

public Object next()
Description copied from class: AbstractIterator
Moves, bumps, or "increments" the iterator along the traversal; returns the next value considered. This method should only be called if the iterator has a next value. To get a value from an iterator multiple times, use the value method.

This method is preferred over the nextElement method.

Specified by:
next in interface Iterator
Specified by:
next in class AbstractIterator
Returns:
the current value
See Also:
AbstractIterator.hasMoreElements(), AbstractIterator.value()

get

public Object get()
Description copied from class: AbstractIterator
Returns the value currently being considered by the AbstractIterator. This method is required by neither Iterator nor Enumeration. This method should be implemented, however, to provide better support for for-loops.

Specified by:
get in class AbstractIterator
Returns:
the next value to be considered in iterator