java.util.ListIterator over an array.
The array can be either an array of object or of primitives. If you know
that you have an object array, the ObjectArrayListIterator
class is a better choice, as it will perform better.
This iterator does not support add(Object) or remove(), as the array
cannot be changed in size. The set(Object) method is supported however.
org.apache.commons.collections4.iterators.ArrayIterator , java.util.Iterator , java.util.ListIterator
| Modifier and Type | Field and Description |
|---|---|
| private int | lastItemIndex
Holds the index of the last item returned by a call to |
| Access | Constructor and Description |
|---|---|
| public | ArrayListIterator(final Object
the array to iterate over array)Constructs an ArrayListIterator that will iterate over the values in the specified array. |
| public | ArrayListIterator(final Object
the array to iterate over array, final int the index to start iterating at startIndex)Constructs an ArrayListIterator that will iterate over the values in the specified array from a specific start index. |
| public | ArrayListIterator(final Object
the array to iterate over array, final int the index to start iterating at startIndex, final int the index (exclusive) to finish iterating at endIndex)Construct an ArrayListIterator that will iterate over a range of values in the specified array. |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(final Object
the element to add o)Implements java. UnsupportedOperationException when this method is invoked.
|
| public boolean | Returns: true if there is a previous element to returnImplements java. |
| public E | Returns: the next elementOverrides org. Implements java. |
| public int | Returns: the index of the item to be retrieved nextImplements java. |
| public E | Returns: the previous elementImplements java. |
| public int | Returns: the index of the item to be retrieved nextImplements java. previous() is called.
|
| public void | reset()
Overrides org. Implements org. |
| public void | set(final Object
the element to set o)Implements java. |
| lastItemIndex | back to summary |
|---|---|
| private int lastItemIndex Holds the index of the last item returned by a call to | |
| ArrayListIterator | back to summary |
|---|---|
| public ArrayListIterator(final Object array) Constructs an ArrayListIterator that will iterate over the values in the specified array.
| |
| ArrayListIterator | back to summary |
|---|---|
| public ArrayListIterator(final Object array, final int startIndex) Constructs an ArrayListIterator that will iterate over the values in the specified array from a specific start index.
| |
| ArrayListIterator | back to summary |
|---|---|
| public ArrayListIterator(final Object array, final int startIndex, final int endIndex) Construct an ArrayListIterator that will iterate over a range of values in the specified array.
| |
| add | back to summary |
|---|---|
| public void add(final Object o) Implements java. This iterator does not support modification of its backing collection, and so will
always throw an
| |
| hasPrevious | back to summary |
|---|---|
| public boolean hasPrevious() Implements java. Returns true if there are previous elements to return from the array.
| |
| next | back to summary |
|---|---|
| public E next() Overrides org. Implements java. Gets the next element from the array.
| |
| nextIndex | back to summary |
|---|---|
| public int nextIndex() Implements java. Gets the next index to be retrieved.
| |
| previous | back to summary |
|---|---|
| public E previous() Implements java. Gets the previous element from the array.
| |
| previousIndex | back to summary |
|---|---|
| public int previousIndex() Implements java. Gets the index of the item to be retrieved if
| |
| reset | back to summary |
|---|---|
| public void reset() Overrides org. Implements org. Resets the iterator back to the start index.
| |
| set | back to summary |
|---|---|
| public void set(final Object o) Implements java. Sets the element under the cursor.
This method sets the element that was returned by the last call
to Note
| |