|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.util.IteratorAdapter
diva.util.NullArrayIterator
public class NullArrayIterator
An iterator over a given array which may contain nulls. Any element of the array that is null is not returned, but is skipped over. A null value (of the whole array) is treated as an empty array. This class can be subclassed to implement the remove() method. The method getLastIndex() return the index of the previously returned element.
Field Summary | |
---|---|
(package private) java.lang.Object[] |
_array
|
(package private) int |
_arraylen
|
(package private) int |
_lastindex
|
(package private) int |
_nextindex
|
Constructor Summary | |
---|---|
NullArrayIterator(java.lang.Object[] array)
Construct an iterator over the given array |
|
NullArrayIterator(java.lang.Object[] array,
int length)
Construct an iterator over the given array, where the effective array length is given by the length argument (and must be smaller than the real length of the array). |
Method Summary | |
---|---|
protected void |
advance()
Advance the next index to the next non-null element. |
protected int |
getLastIndex()
Return the index of the element last returned. |
boolean |
hasNext()
Return true if there are more non-null elements in the array. |
java.lang.Object |
next()
Return the next non-null element in the array. |
Methods inherited from class diva.util.IteratorAdapter |
---|
remove |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
java.lang.Object[] _array
int _lastindex
int _nextindex
int _arraylen
Constructor Detail |
---|
public NullArrayIterator(java.lang.Object[] array)
public NullArrayIterator(java.lang.Object[] array, int length)
Method Detail |
---|
protected void advance()
protected int getLastIndex()
public boolean hasNext()
hasNext
in interface java.util.Iterator
hasNext
in class IteratorAdapter
public java.lang.Object next()
next
in interface java.util.Iterator
next
in class IteratorAdapter
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |