|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.misc.ArrayIterator<T>
public class ArrayIterator<T>
The ArrayIterator class provides a bridge between an array of objects and an Iterator. It's useful in cases where you have an array, but you need an Iterator; using an instance of ArrayIterator saves copying the array's contents into a Collection, just to get an Iterator.
Iterator| Constructor Summary | |
|---|---|
ArrayIterator(T[] array)
Allocate a new ArrayIterator object that will iterate over the specified array of objects. |
|
ArrayIterator(T[] array,
int index)
Allocate a new ArrayIterator object that will iterate over the specified array of objects, starting at a particular index. |
|
| Method Summary | |
|---|---|
int |
getNextIndex()
Get the index of the next element to be retrieved. |
boolean |
hasNext()
Determine whether the underlying Iterator has more elements. |
T |
next()
Get the next element from the underlying array. |
T |
previous()
Get the previous element from the underlying array. |
void |
remove()
Required by the Iterator interface, but not supported by this class. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayIterator(T[] array)
array - The array over which to iterate
public ArrayIterator(T[] array,
int index)
array - The array over which to iterateindex - The index at which to start| Method Detail |
|---|
public int getNextIndex()
public boolean hasNext()
hasNext in interface java.util.Iterator<T>next()
public T next()
throws java.util.NoSuchElementException
next in interface java.util.Iterator<T>java.util.NoSuchElementException - No more elements existprevious(),
Iterator.next()
public T previous()
throws java.util.NoSuchElementException
java.util.NoSuchElementException - Attempt to move internal index before the first array elementnext()public void remove()
remove in interface java.util.Iterator<T>java.lang.UnsupportedOperationException - unconditionally
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||