An Iterator wrapper for an Object[]. This will allow us to deal with all array like structures in a consistent manner.
WARNING : this class's operations are NOT synchronized. It is meant to be used in a single thread, newly created for each use in the #foreach() directive. If this is used or shared, synchronize in the next() method.
| Modifier and Type | Field and Description |
|---|---|
| private final Object | array
The objects to iterate over. |
| private int | pos
The current position and size in the array. |
| private final int | size
The size of the array. |
| Access | Constructor and Description |
|---|---|
| public | ArrayIterator(Object
The array for which an iterator is desired. arr)Creates a new iterator instance for the specified array. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: Whether there is another element.Implements java. |
| public Object | Returns: The next object in the array.Implements java. |
| public void | remove()
Overrides default java. Iterator interface.
|
| array | back to summary |
|---|---|
| private final Object array The objects to iterate over. | |
| pos | back to summary |
|---|---|
| private int pos The current position and size in the array. | |
| size | back to summary |
|---|---|
| private final int size The size of the array. | |
| ArrayIterator | back to summary |
|---|---|
| public ArrayIterator(Object arr) Creates a new iterator instance for the specified array.
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Check to see if there is another element in the array.
| |
| next | back to summary |
|---|---|
| public Object next() Implements java. Move to next element in the array.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. No op--merely added to satify the | |