Class FilterIterator<E>
- java.lang.Object
-
- org.eclipse.rdf4j.common.iterator.FilterIterator<E>
-
- All Implemented Interfaces:
java.util.Iterator<E>
public abstract class FilterIterator<E> extends java.lang.Object implements java.util.Iterator<E>
A CloseableIterator that wraps another iterator, applying a filter on the objects that are returned. Subclasses must implement the accept method to indicate which objects should be returned.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Iterator<? extends E>
filteredIter
private E
nextElement
-
Constructor Summary
Constructors Modifier Constructor Description protected
FilterIterator(java.util.Iterator<? extends E> iter)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
accept(E object)
Tests whether or not the specified object should be returned by this iterator.private void
findNextElement()
boolean
hasNext()
E
next()
void
remove()
-
-
-
Constructor Detail
-
FilterIterator
protected FilterIterator(java.util.Iterator<? extends E> iter)
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<E>
-
findNextElement
private void findNextElement()
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<E>
-
accept
protected abstract boolean accept(E object)
Tests whether or not the specified object should be returned by this iterator. All objects from the wrapped iterator pass through this method in the same order as they are coming from the wrapped iterator.- Parameters:
object
- The object to be tested.- Returns:
- true if the object should be returned, false otherwise.
- Throws:
X
-
-