java.lang.Object | +--org.apache.commons.collections.iterators.ObjectArrayIteratorAll Implemented Interfaces:
Object[] | The array |
int | The end index to loop to |
int | The current iterator index |
int | The start index to loop from |
Constructor for use with setArray. |
ObjectArrayIterator(Object[] array) Constructs an ObjectArrayIterator that will iterate over the values in the specified array. |
ObjectArrayIterator(Object[] array, int start) Constructs an ObjectArrayIterator that will iterate over the values in the specified array from a specific start index. |
ObjectArrayIterator(Object[] array, int start, int end) Construct an ObjectArrayIterator that will iterate over a range of values in the specified array. |
Object[] | getArray() Gets the array that this iterator is iterating over. |
int | Gets the end index to loop to. |
int | Gets the start index to loop from. |
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(Object[] array) Sets the array that the ArrayIterator should iterate over. |
protected Object[] array
protected int endIndex
protected int index
protected int startIndex
public ObjectArrayIterator()
setArray
.
Using this constructor, the iterator is equivalent to an empty iterator
until setArray is called to establish the array to iterate over.
public ObjectArrayIterator(Object[] array, int start, int end)
- if the start or end index is out of bounds
- if end index is before the start
- if array is nullpublic ObjectArrayIterator(Object[] array, int start)
- if array is null
- if the start index is out of boundspublic ObjectArrayIterator(Object[] array)
- if array is nullpublic Object[] getArray()
public int getEndIndex()
public int getStartIndex()
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(Object[] array)
- if the array was set in the constructor
- if array is null