Package org.apache.jena.util.iterator
Class FilterIterator<T>
- 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:
java.util.Iterator<T>
,IteratorCloseable<T>
,Closeable
,ClosableIterator<T>
,ExtendedIterator<T>
public class FilterIterator<T> extends WrappedIterator<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
Constructors Constructor Description FilterIterator(java.util.function.Predicate<T> fl, java.util.Iterator<T> e)
Initialises a FilterIterator with its filter and base.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Answer true iff there is at least one more acceptable object.T
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
-
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
Answer true iff there is at least one more acceptable object. [Stores reference intocurrent
, setscanRemove
false; answer preserved in `hasCurrent`]- Specified by:
hasNext
in interfacejava.util.Iterator<T>
- Overrides:
hasNext
in classWrappedIterator<T>
-
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.- Specified by:
remove
in interfacejava.util.Iterator<T>
- Overrides:
remove
in classWrappedIterator<T>
-
next
public T next()
Answer the next acceptable object from the base iterator. The redundant test of `hasCurrent` appears to make a detectable speed difference. Crazy.- Specified by:
next
in interfacejava.util.Iterator<T>
- Overrides:
next
in classWrappedIterator<T>
-
-