org.jwarp.util
Class ArrayIterator
java.lang.Object
|
+--org.jwarp.util.ArrayIterator
- All Implemented Interfaces:
- java.util.Iterator
- public final class ArrayIterator
- extends java.lang.Object
- implements java.util.Iterator
This provides an iterator interface to an array
|
Field Summary |
(package private) java.lang.Object[] |
a
The underlying array |
(package private) int |
pos
The current position |
|
Constructor Summary |
ArrayIterator(java.lang.Object[] array)
Construct an iterator given an enumeration |
|
Method Summary |
boolean |
hasNext()
Return true if we have not yet reached the end of the enumeration |
java.lang.Object |
next()
Advance the iterator and return the next value. |
void |
remove()
This method is not supported. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
a
final java.lang.Object[] a
- The underlying array
pos
int pos
- The current position
ArrayIterator
public ArrayIterator(java.lang.Object[] array)
- Construct an iterator given an enumeration
- Parameters:
The - basic array
hasNext
public final boolean hasNext()
- Return true if we have not yet reached the end of the enumeration
- Specified by:
hasNext in interface java.util.Iterator
- Returns:
- true If it has more elements
next
public final java.lang.Object next()
throws java.util.NoSuchElementException
- Advance the iterator and return the next value. Return null if we reach the end of the enumeration.
- Specified by:
next in interface java.util.Iterator
- Returns:
- The next element
- Throws:
java.util.NoSuchElementException - If the operation failed.
remove
public final void remove()
throws java.lang.UnsupportedOperationException
- This method is not supported.
- Specified by:
remove in interface java.util.Iterator