T
- the item type.public class ArrayIterator<T> extends java.lang.Object implements BoundedIterator<T>
ArrayIterator
implements a simple array-based iterator.Modifier | Constructor and Description |
---|---|
protected |
ArrayIterator(ArrayIterator<T> r)
Constructs a copy of the array iterator.
|
|
ArrayIterator(java.util.ArrayList<T> array)
Constructs an array iterator.
|
|
ArrayIterator(T[] array)
Constructs an array iterator.
|
Modifier and Type | Method and Description |
---|---|
ArrayIterator<T> |
clone()
Creates a copy of the iterator.
|
boolean |
hasValue()
Checks if the iterator is not exhausted (a value is available).
|
void |
init()
Initializes the iterator.
|
void |
next()
Makes an iteration.
|
int |
size()
Returns the size of the collection of the iterated items.
|
void |
stop()
Stops the iterator.
|
T |
value()
Returns the current value of the iterator.
|
public ArrayIterator(T[] array)
array
- the array to be iterated.public ArrayIterator(java.util.ArrayList<T> array)
array
- the array list to be iterated.protected ArrayIterator(ArrayIterator<T> r)
r
- the iterator to be copied.public void init()
Iterator
public boolean hasValue()
Iterator
public T value()
Iterator
public void next()
Iterator
public void stop()
Iterator
public int size()
BoundedIterator
size
in interface BoundedIterator<T>