java.lang.Object | +--org.apache.commons.collections.iterators.ArrayIteratorAll Implemented Interfaces:
Object | The array to iterate over |
int | The end index to loop to |
int | The current iterator index |
int | The start index to loop from |
Constructor for use with setArray. |
ArrayIterator(final Object array) Constructs an ArrayIterator that will iterate over the values in the specified array. |
ArrayIterator(final Object array, final int startIndex) Constructs an ArrayIterator that will iterate over the values in the specified array from a specific start index. |
ArrayIterator(final Object array, final int startIndex, final int endIndex) Construct an ArrayIterator that will iterate over a range of values in the specified array. |
void | checkBound(final int bound, final String type) Checks whether the index is valid or not. |
Object | getArray() Gets the array that this iterator is iterating over. |
boolean | hasNext() Returns true if there are more elements to return from the array. |
Object | next() Returns the next element in the array. |
void | remove() Throws UnsupportedOperationException. |
void | reset() Resets the iterator back to the start index. |
void | setArray(final Object array) Sets the array that the ArrayIterator should iterate over. |
protected Object array
protected int endIndex
protected int index
protected int startIndex
public ArrayIterator()
setArray
.
Using this constructor, the iterator is equivalent to an empty iterator
until setArray(Object) is called to establish the array to iterate over.
public ArrayIterator(final Object array, final int startIndex, final int endIndex)
- if array is not an array.
- if array is null
- if either index is invalidpublic ArrayIterator(final Object array, final int startIndex)
- if array is not an array.
- if array is null
- if the index is invalidpublic ArrayIterator(final Object array)
- if array is not an array.
- if array is nullprotected void checkBound(final int bound, final String type)
- if the index is invalidpublic Object getArray()
public boolean hasNext()
public Object next()
- if all the elements in the array
have already been returnedpublic void remove()
- alwayspublic void reset()
public void setArray(final Object array)
- if array is not an array.
- if array is null