java.util.ListIterator over an array of objects.
This iterator does not support add or remove, as the object array
cannot be structurally modified. The set method is supported however.
The iterator implements a reset method, allowing the reset of the iterator
back to the start if required.
org.apache.commons.collections4.iterators.ObjectArrayIterator , 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 | ObjectArrayListIterator(final E...
the array to iterate over array)Constructs an ObjectArrayListIterator that will iterate over the values in the specified array. |
| public | ObjectArrayListIterator(final E[]
the array to iterate over array, final int the index to start iterating at start)Constructs an ObjectArrayListIterator that will iterate over the values in the specified array from a specific start index. |
| public | ObjectArrayListIterator(final E[]
the array to iterate over array, final int the index to start iterating at start, final int the index (exclusive) to finish iterating at end)Construct an ObjectArrayListIterator that will iterate over a range of values in the specified array. |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(final E
the object to add obj)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 E
the object to set into the array obj)Implements java. |
| lastItemIndex | back to summary |
|---|---|
| private int lastItemIndex Holds the index of the last item returned by a call to | |
| ObjectArrayListIterator | back to summary |
|---|---|
| public ObjectArrayListIterator(final E... array) Constructs an ObjectArrayListIterator that will iterate over the values in the specified array.
| |
| ObjectArrayListIterator | back to summary |
|---|---|
| public ObjectArrayListIterator(final E[] array, final int start) Constructs an ObjectArrayListIterator that will iterate over the values in the specified array from a specific start index.
| |
| ObjectArrayListIterator | back to summary |
|---|---|
| public ObjectArrayListIterator(final E[] array, final int start, final int end) Construct an ObjectArrayListIterator that will iterate over a range of values in the specified array.
| |
| add | back to summary |
|---|---|
| public void add(final E obj) Implements java. This iterator does not support modification of its backing array's size, 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 E obj) Implements java. Sets the element under the cursor.
This method sets the element that was returned by the last call
to Note
| |