java.lang.Object
org.apache.jena.util.iterator.NiceIterator<T>
- All Implemented Interfaces:
Iterator<T>,org.apache.jena.atlas.iterator.IteratorCloseable<T>,org.apache.jena.atlas.lib.Closeable,ClosableIterator<T>,ExtendedIterator<T>
- Direct Known Subclasses:
ContNodeIteratorImpl,IteratorOfJenaSets,LazyIterator,Map1Iterator,MapFilterIterator,NullIterator,ObjectIterator,RoaringBitmapTripleIterator,SeqNodeIteratorImpl,SingletonIterator,SparseArrayIndexedIterator,SparseArrayIterator,WrappedIterator
NiceIterator is the standard base class implementing ExtendedIterator. It provides
the static methods for
andThen, filterKeep and
filterDrop; these can be reused from any other class. It defines
equivalent instance methods for descendants and to satisfy ExtendedIterator.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> ExtendedIterator<T>concatenate two closable iterators.<X extends T>
ExtendedIterator<T>make a new iterator, which is us then the other chap.static <T> List<T>asList(ExtendedIterator<T> it) Answer a list of the elements fromit, in order, consuming that iterator.static <T> Set<T>asSet(ExtendedIterator<T> it) Answer a list of the elements ofitin order, consuming this iterator.voidclose()default close: don't need to do anything.static voidIfitisCloseable, close it.static <T> ExtendedIterator<T>An iterator over no elements.filterDrop(Predicate<T> f) make a new iterator, which is our elements that do not pass the filterfilterKeep(Predicate<T> f) make a new iterator, which is our elements that pass the filterbooleanhasNext()default hasNext: no elements, return false.<U> ExtendedIterator<U>make a new iterator which is the elementwise _map1_ of the base iterator.next()default next: throw an exception.voidremove()default remove: we have no elements, so we can't remove any.Answer the next object, and remove it.toList()Answer a list of the elements in order, consuming this iterator.toSet()Answer a list of the elements in order, consuming this iterator.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jena.util.iterator.ExtendedIterator
forEach, nextOptionalMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
NiceIterator
public NiceIterator()
-
-
Method Details
-
close
public void close()default close: don't need to do anything.- Specified by:
closein interfaceClosableIterator<T>- Specified by:
closein interfaceorg.apache.jena.atlas.lib.Closeable
-
hasNext
public boolean hasNext()default hasNext: no elements, return false. -
next
default next: throw an exception. -
remove
public void remove()default remove: we have no elements, so we can't remove any. -
removeNext
Answer the next object, and remove it.- Specified by:
removeNextin interfaceExtendedIterator<T>
-
andThen
concatenate two closable iterators. -
andThen
make a new iterator, which is us then the other chap.- Specified by:
andThenin interfaceExtendedIterator<T>
-
filterKeep
make a new iterator, which is our elements that pass the filter- Specified by:
filterKeepin interfaceExtendedIterator<T>
-
filterDrop
make a new iterator, which is our elements that do not pass the filter- Specified by:
filterDropin interfaceExtendedIterator<T>
-
mapWith
make a new iterator which is the elementwise _map1_ of the base iterator.- Specified by:
mapWithin interfaceExtendedIterator<T>
-
close
IfitisCloseable, close it. -
emptyIterator
An iterator over no elements.- Returns:
- A class singleton which doesn't iterate.
-
toList
Answer a list of the elements in order, consuming this iterator.- Specified by:
toListin interfaceExtendedIterator<T>
-
toSet
Answer a list of the elements in order, consuming this iterator.- Specified by:
toSetin interfaceExtendedIterator<T>
-
asSet
Answer a list of the elements ofitin order, consuming this iterator. Canonical implementation of toSet(). -
asList
Answer a list of the elements fromit, in order, consuming that iterator. Canonical implementation of toList().
-