Class FilterIteration<E>
java.lang.Object
org.eclipse.rdf4j.common.iteration.FilterIteration<E>
- All Implemented Interfaces:
AutoCloseable
,Iterator<E>
,CloseableIteration<E>
- Direct Known Subclasses:
DistinctIteration
,FilteringIteration
,FilterIterator
,IntersectIteration
,MinusIteration
,OffsetIteration
,ReducedIteration
,SPARQLMinusIteration
A CloseableIteration that wraps another Iteration, applying a filter on the objects that are returned. Subclasses
must implement the accept method to indicate which objects should be returned.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
Tests whether or not the specified object should be returned by this Iteration.final void
close()
CallshandleClose()
upon first call and makes sure the resource closures are only executed once.protected abstract void
Closes this Iteration and also closes the wrapped Iteration if it is aCloseableIteration
.boolean
hasNext()
next()
void
remove()
Removes the last element that has been returned from the wrapped Iteration.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration
stream
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FilterIteration
- Parameters:
iter
-
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
accept
Tests whether or not the specified object should be returned by this Iteration. All objects from the wrapped Iteration pass through this method in the same order as they are coming from the wrapped Iteration.- Parameters:
object
- The object to be tested.- Returns:
- true if the object should be returned, false otherwise.
-
remove
public void remove()Removes the last element that has been returned from the wrapped Iteration.- Specified by:
remove
in interfaceIterator<E>
- Throws:
UnsupportedOperationException
- If the wrapped Iteration does not support the remove operation.IllegalStateException
- if the Iteration has been closed, or ifnext()
has not yet been called, orremove()
has already been called after the last call tonext()
.
-
handleClose
protected abstract void handleClose()Closes this Iteration and also closes the wrapped Iteration if it is aCloseableIteration
. -
close
public final void close()CallshandleClose()
upon first call and makes sure the resource closures are only executed once.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseableIteration<E>
-