java.lang.Object
org.apache.jena.util.iterator.NiceIterator<T>
org.apache.jena.util.iterator.WrappedIterator<T>
org.apache.jena.util.iterator.FilterIterator<T>
- All Implemented Interfaces:
Iterator<T>
,org.apache.jena.atlas.iterator.IteratorCloseable<T>
,org.apache.jena.atlas.lib.Closeable
,ClosableIterator<T>
,ExtendedIterator<T>
Creates a sub-Iterator by filtering. This class should not be used
directly any more; the subclasses FilterKeepIterator and FilterDropIterator
should be used instead.
-
Constructor Summary
ConstructorDescriptionFilterIterator
(Predicate<T> fl, Iterator<T> e) Initialises a FilterIterator with its filter and base. -
Method Summary
Modifier and TypeMethodDescriptionvoid
forEachRemaining
(Consumer<? super T> action) forEachRemaining: defer to the base iteratorboolean
hasNext()
Answer true iff there is at least one more acceptable object.next()
Answer the next acceptable object from the base iterator.void
remove()
Remove the current member from the underlying iterator.Methods inherited from class org.apache.jena.util.iterator.WrappedIterator
close, close, create, createIteratorIterator, createNoRemove, forTestingOnly_getBase, ofStream
Methods inherited from class org.apache.jena.util.iterator.NiceIterator
andThen, andThen, asList, asSet, emptyIterator, filterDrop, filterKeep, mapWith, removeNext, toList, toSet
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jena.util.iterator.ExtendedIterator
forEach, nextOptional
-
Constructor Details
-
FilterIterator
Initialises a FilterIterator with its filter and base.- Parameters:
fl
- An object is included if it is accepted by this Filter.e
- The base Iterator.
-
-
Method Details
-
hasNext
public boolean hasNext()Answer true iff there is at least one more acceptable object. [Stores reference intocurrent
, setscanRemove
false; answer preserved in `hasCurrent`] -
remove
public void remove()Remove the current member from the underlying iterator. Legal only after a .next() but before any subsequent .hasNext(), because that may advance the underlying iterator. -
next
Answer the next acceptable object from the base iterator. The redundant test of `hasCurrent` appears to make a detectable speed difference. Crazy. -
forEachRemaining
Description copied from class:WrappedIterator
forEachRemaining: defer to the base iterator- Specified by:
forEachRemaining
in interfaceIterator<T>
- Overrides:
forEachRemaining
in classWrappedIterator<T>
-