Package org.apache.jena.util.iterator
Class WrappedIterator<T>
java.lang.Object
org.apache.jena.util.iterator.NiceIterator<T>
org.apache.jena.util.iterator.WrappedIterator<T>
- All Implemented Interfaces:
Iterator<T>
,IteratorCloseable<T>
,Closeable
,ClosableIterator<T>
,ExtendedIterator<T>
- Direct Known Subclasses:
FilterIterator
,NodeIteratorImpl
,NsIteratorImpl
,RandomOrderIterator
,ResIteratorImpl
,RSIteratorImpl
,StmtIteratorImpl
,TrackingTripleIterator
a WrappedIterator is an ExtendedIterator wrapping around a plain (or
presented as plain) Iterator. The wrapping allows the usual extended
operations (filtering, concatenating) to be done on an Iterator derived
from some other source.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
close: defer to the base, iff it is closablestatic void
ifit
is a Closableiterator, close it.static <T> ExtendedIterator<T>
Answer an ExtendedIterator returning the elements ofit
.static <T> ExtendedIterator<T>
createIteratorIterator
(Iterator<Iterator<T>> it) Given an Iterator that returns Iterator's, this creates an Iterator over the next level values.static <T> WrappedIterator<T>
createNoRemove
(Iterator<T> it) Answer an ExtendedIterator wrapped roundit
which does not permit.remove()
even ifit
does.boolean
hasNext()
hasNext: defer to the base iteratornext()
next: defer to the base iteratorstatic <T> WrappedIterator<T>
Answer an ExtendedIterator wrapped round aStream
.void
remove()
if .remove() is allowed, delegate to the base iterator's .remove; otherwise, throw an UnsupportedOperationException.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
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Method Details
-
create
Answer an ExtendedIterator returning the elements ofit
. Ifit
is itself an ExtendedIterator, return that; otherwise wrapit
. -
createNoRemove
Answer an ExtendedIterator wrapped roundit
which does not permit.remove()
even ifit
does. -
ofStream
Answer an ExtendedIterator wrapped round aStream
. The extended iterator does not permit.remove()
.The stream should not be used directly. The effect of doing so is undefined.
-
createIteratorIterator
Given an Iterator that returns Iterator's, this creates an Iterator over the next level values. Similar to list splicing in lisp. -
forTestingOnly_getBase
-
hasNext
public boolean hasNext()hasNext: defer to the base iterator -
next
next: defer to the base iterator -
remove
public void remove()if .remove() is allowed, delegate to the base iterator's .remove; otherwise, throw an UnsupportedOperationException. -
close
public void close()close: defer to the base, iff it is closable- Specified by:
close
in interfaceClosableIterator<T>
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classNiceIterator<T>
-
close
ifit
is a Closableiterator, close it. Abstracts away from tests [that were] scattered through the code.
-