public abstract class FilterIterator extends Object implements Iterator
FilterIterator
contains another iterator and returns only
objects not to be skipped. To implement special filter behaviour simply
overwrite the skip(Object)
method.Modifier and Type | Field and Description |
---|---|
protected Iterator |
iterator_
The input iterator.
|
protected Object |
nextObj_
The next object to be returned by
next() . |
Constructor and Description |
---|
FilterIterator(Iterator iterator)
Creates a new
FilterIterator using the given
iterator as input. |
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
Object |
next() |
void |
remove() |
protected abstract boolean |
skip(Object obj)
Returns
true if the given obj ect should NOT be
returned by the next() method, otherwise returns false
. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
protected Iterator iterator_
public FilterIterator(Iterator iterator)
FilterIterator
using the given
iterator
as input.iterator
- the input iteratorpublic boolean hasNext()
hasNext
in interface Iterator
Iterator.hasNext()
public Object next()
next
in interface Iterator
Iterator.next()
public void remove()
remove
in interface Iterator
UnsupportedOperationException
Iterator.remove()
protected abstract boolean skip(Object obj) throws SkipException
true
if the given obj
ect should NOT be
returned by the next()
method, otherwise returns false
.
Overwrite this method to implement specific filtering of Node
s.
obj
- the object to be testedtrue
if the object should be skipped,
false
otherwiseSkipException
© 2002-2005 IAIK, © 2004, 2006 - 2019 Stiftung SIC