public class XArrayIterator<T> extends Object implements XIterator<T>
XIterator
that iterates over an array.Constructor and Description |
---|
XArrayIterator(T[] array)
Constructs a new array iterator.
|
XArrayIterator(T[] array,
int offset,
int length)
Constructs a new array iterator.
|
Modifier and Type | Method and Description |
---|---|
T[] |
array()
The array backing this iterator.
|
boolean |
hasNext() |
int |
length()
Gets the length of the iterator (the number of elements it returns
starting with the offset).
|
T |
next() |
int |
offset()
Gets the offset into the backing array at which this
iterator starts.
|
void |
remove()
Remove is not supported for array iterators.
|
XArrayIterator<T> |
toFirst()
Resets the iterator to the first element.
|
public XArrayIterator(T[] array)
array
- The array to iterate.public XArrayIterator(T[] array, int offset, int length)
array
- The backing array.offset
- The offset into the array.length
- The length the number of elements including the offset to iterate.public final T[] array()
public final int offset()
public final int length()
public final void remove()
remove
in interface Iterator<T>
UnsupportedOperationException
- If called.Copyright © 2019 Neeve Research, LLC. All Rights Reserved.