java.lang.Object
org.apache.jena.util.iterator.NiceIterator<T>
- All Implemented Interfaces:
Iterator<T>
,IteratorCloseable<T>
,Closeable
,ClosableIterator<T>
,ExtendedIterator<T>
- Direct Known Subclasses:
ContNodeIteratorImpl
,LazyIterator
,Map1Iterator
,MapFilterIterator
,NullIterator
,ObjectIterator
,SeqNodeIteratorImpl
,SingletonIterator
,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 ofit
in order, consuming this iterator.void
close()
default close: don't need to do anything.static void
Ifit
isCloseable
, 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 filterboolean
hasNext()
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.void
remove()
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, wait
Methods inherited from interface org.apache.jena.util.iterator.ExtendedIterator
forEach, nextOptional
Methods 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:
close
in interfaceClosableIterator<T>
- Specified by:
close
in interfaceCloseable
-
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:
removeNext
in interfaceExtendedIterator<T>
-
andThen
concatenate two closable iterators. -
andThen
make a new iterator, which is us then the other chap.- Specified by:
andThen
in interfaceExtendedIterator<T>
-
filterKeep
make a new iterator, which is our elements that pass the filter- Specified by:
filterKeep
in interfaceExtendedIterator<T>
-
filterDrop
make a new iterator, which is our elements that do not pass the filter- Specified by:
filterDrop
in interfaceExtendedIterator<T>
-
mapWith
make a new iterator which is the elementwise _map1_ of the base iterator.- Specified by:
mapWith
in interfaceExtendedIterator<T>
-
close
Ifit
isCloseable
, 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:
toList
in interfaceExtendedIterator<T>
-
toSet
Answer a list of the elements in order, consuming this iterator.- Specified by:
toSet
in interfaceExtendedIterator<T>
-
asSet
Answer a list of the elements ofit
in 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().
-