public class ArrayIterator implements Iterator<ElementType>(Code)
Converts an array to an iterator.
More information about this class is available from ostermiller.org.
author: Stephen Ostermiller http://ostermiller.org/contact.pl?regarding=Java+Utilities< Parameters: ElementType - > Type of array over which to iterate since: ostermillerutils 1.03.00
Constructor Summary
public
ArrayIterator(ElementType[] array) Create an Iterator from an Array.
Method Summary
public boolean
hasNext() Tests if this Iterator contains more elements.
public ElementType
next() Returns the next element of this Iterator if this Iterator
object has at least one more element to provide.
public void
remove() Removes the last object from the array by setting the slot in
the array to null.
Tests if this Iterator contains more elements.
true if and only if this Iterator object contains at leastone more element to provide; false otherwise. since: ostermillerutils 1.03.00
Returns the next element of this Iterator if this Iterator
object has at least one more element to provide.
the next element of this Iterator. throws: NoSuchElementException - if no more elements exist. since: ostermillerutils 1.03.00
Removes the last object from the array by setting the slot in
the array to null.
This method can be called only once per call to next.
throws: IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method. since: ostermillerutils 1.03.00