public class ArrayIterator<T> extends Object implements Iterator<T>
Modifier and Type | Field and Description |
---|---|
protected int |
_cnt
The index of the next array element to return
|
protected T[] |
_elts
The array source for the iterator
|
protected int |
last
The index of the last array element to return
|
Constructor and Description |
---|
ArrayIterator(T[] elts) |
ArrayIterator(T[] elts,
int start) |
ArrayIterator(T[] elts,
int start,
int last) |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
T |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected int _cnt
protected final int last
protected final T[] _elts
public ArrayIterator(T[] elts)
elts
- the array which should be iterated overpublic ArrayIterator(T[] elts, int start)
elts
- the array which should be iterated overstart
- the first array index to returnpublic ArrayIterator(T[] elts, int start, int last)
elts
- the array which should be iterated overstart
- the first array index to returnpublic T next() throws NoSuchElementException
next
in interface Iterator<T>
NoSuchElementException
public void remove() throws UnsupportedOperationException
remove
in interface Iterator<T>
UnsupportedOperationException