|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.cosylab.util.ArrayEnumeration
public class ArrayEnumeration
A simple implementation of both the java.util.Enumeration
and
java.util.Iterator
that iterates over the array of type
Object[]
. Removal of elements is not permitted. The iteration
is not thread safe.
Field Summary | |
---|---|
protected java.lang.Object[] |
array
The array storing the data over which this iterator will iterate. |
Constructor Summary | |
---|---|
ArrayEnumeration(java.lang.Object[] array)
Creates a new instance of array enumeration, given the array over which this instance will iterate. |
Method Summary | |
---|---|
boolean |
hasMoreElements()
Returns true iff calling nextElement() will
return a valid value. |
boolean |
hasNext()
A shorthand for hasMoreElements() |
java.lang.Object |
next()
A shorthand for nextElement() . |
java.lang.Object |
nextElement()
Returns the next element in the array. |
void |
remove()
Not implemented. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object[] array
Constructor Detail |
---|
public ArrayEnumeration(java.lang.Object[] array)
array
- array of iteration, non-null
Method Detail |
---|
public boolean hasMoreElements()
true
iff calling nextElement()
will
return a valid value.
hasMoreElements
in interface java.util.Enumeration
true
if there are more elements to be iterated over
in the arraypublic java.lang.Object nextElement()
hasMoreElements()
returns false
, an array
index out of bounds exception will be thrown.
nextElement
in interface java.util.Enumeration
null
public boolean hasNext()
hasMoreElements()
hasNext
in interface java.util.Iterator
true
iff this array has more elements to be
iterated overpublic java.lang.Object next()
nextElement()
.
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
java.lang.UnsupportedOperationException
- always
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |