diva.util
Class FilteredArrayIterator
java.lang.Object
diva.util.IteratorAdapter
diva.util.NullArrayIterator
diva.util.FilteredArrayIterator
- All Implemented Interfaces:
- java.util.Iterator
public abstract class FilteredArrayIterator
- extends NullArrayIterator
An iterator over an array, in which elements are filtered
by some function. To make this efficient, the filter is specified
by overriding the accept() method in a subclass rather than
by passing an instance of the Filter class.
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.
- Version:
- $Id: FilteredArrayIterator.java 38798 2005-07-08 20:00:01Z cxh $
- Author:
- John Reekie
Method Summary |
abstract boolean |
accept(java.lang.Object o)
Test if the object is acceptable for return by the iterator. |
protected void |
advance()
Advance the next index to the next non-null element. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
FilteredArrayIterator
public FilteredArrayIterator(java.lang.Object[] array)
FilteredArrayIterator
public FilteredArrayIterator(java.lang.Object[] array,
int length)
accept
public abstract boolean accept(java.lang.Object o)
- Test if the object is acceptable for return by the iterator.
advance
protected void advance()
- Advance the next index to the next non-null element. Set it
to -1 if there are no more elements.
- Overrides:
advance
in class NullArrayIterator