ElementType
- Type of array over which to iteratepublic class ArrayIterator<ElementType>
extends java.lang.Object
implements java.util.Iterator<ElementType>
More information about this class is available from ostermiller.org.
Constructor and Description |
---|
ArrayIterator(ElementType[] array)
Create an Iterator from an Array.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Tests if this Iterator contains more elements.
|
ElementType |
next()
Returns the next element of this Iterator if this Iterator
object has at least one more element to provide.
|
void |
remove()
Removes the last object from the array by setting the slot in
the array to null.
|
public ArrayIterator(ElementType[] array)
array
- of objects on which to enumerate.public boolean hasNext()
hasNext
in interface java.util.Iterator<ElementType>
public ElementType next() throws java.util.NoSuchElementException
next
in interface java.util.Iterator<ElementType>
java.util.NoSuchElementException
- if no more elements exist.public void remove()
remove
in interface java.util.Iterator<ElementType>
java.lang.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.Copyright (c) 2001-2020 by Stephen Ostermiller