- Type Parameters:
T- the type of element over which an instance of ExtendedIterator iterates
- All Superinterfaces:
ClosableIterator<T>,org.apache.jena.atlas.lib.Closeable,Iterator<T>,org.apache.jena.atlas.iterator.IteratorCloseable<T>
- All Known Subinterfaces:
NodeIterator,NsIterator,ResIterator,StmtIterator,TripleIterator
- All Known Implementing Classes:
ContNodeIteratorImpl,FilterIterator,IteratorOfJenaSets,LazyIterator,Map1Iterator,MapFilterIterator,NiceIterator,NodeIteratorImpl,NsIteratorImpl,NullIterator,ObjectIterator,ResIteratorImpl,RoaringBitmapTripleIterator,SeqNodeIteratorImpl,SingletonIterator,SparseArrayIndexedIterator,SparseArrayIterator,StmtIteratorImpl,StoreTripleIterator,TrackingTripleIterator,WrappedIterator
An ExtendedIterator is a
NOTE that the result of these operations consumes the base iterator(s); they do not make independent copies.
The canonical implementation of ExtendedIterator is
ClosableIterator on which other operations
are defined for convenience in iterator composition: composition, filtering
in, filtering out, and element mapping.NOTE that the result of these operations consumes the base iterator(s); they do not make independent copies.
The canonical implementation of ExtendedIterator is
NiceIterator,
which also defines static methods for these operations that will work on any
ClosableIterators. -
Method Summary
Modifier and TypeMethodDescription<X extends T>
ExtendedIterator<T>return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator.filterDrop(Predicate<T> f) return a new iterator containing only the elements of _this_ which are rejected by the filter _f_.filterKeep(Predicate<T> f) return a new iterator containing only the elements of _this_ which pass the filter _f_.default voidExecute an action on each element of the iterator.<U> ExtendedIterator<U>return a new iterator where each element is the result of applying _map1_ to the corresponding element of _this_.Answer with anOptional.Answer the next object, and remove it.toList()Answer a list of the [remaining] elements of this iterator, in order, consuming this iterator.toSet()Answer a set of the [remaining] elements of this iterator, consuming this iterator.Methods inherited from interface org.apache.jena.util.iterator.ClosableIterator
closeMethods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Method Details
-
removeNext
T removeNext()Answer the next object, and remove it. Equivalent to next(); remove(). -
andThen
return a new iterator which delivers all the elements of this iterator and then all the elements of the other iterator. Does not copy either iterator; they are consumed as the result iterator is consumed. -
filterKeep
return a new iterator containing only the elements of _this_ which pass the filter _f_. The order of the elements is preserved. Does not copy _this_, which is consumed as the result is consumed. -
filterDrop
return a new iterator containing only the elements of _this_ which are rejected by the filter _f_. The order of the elements is preserved. Does not copy _this_, which is consumed as the result is consumed. -
mapWith
return a new iterator where each element is the result of applying _map1_ to the corresponding element of _this_. _this_ is not copied; it is consumed as the result is consumed. -
forEach
Execute an action on each element of the iterator. This operation ends and closes theExtendedIteratoreven if there is an exception. Shorter name for "Iterator.forEachRemaining", adding exception handling. -
toList
Answer a list of the [remaining] elements of this iterator, in order, consuming this iterator. -
toSet
Answer a set of the [remaining] elements of this iterator, consuming this iterator. -
nextOptional
Answer with anOptional. This operation assumes that theExtendedIteratordoes not return null fornext(). If it does,NullPointerExceptionis thrown.- If there is no next, return
Optional.empty() - If the next object exists, and is not null, return that in the
Optional. - If the next object exists, and is null, throw
NullPointerException
- If there is no next, return
-