T
- the type of element over which an instance of ExtendedIterator
iteratespublic interface ExtendedIterator<T> extends ClosableIterator<T>
ClosableIterator
on which other operations
are defined for convenience in iterator composition: composition, filtering
in, filtering out, and element mapping.NiceIterator
,
which also defines static methods for these operations that will work on any
ClosableIterator
s. Modifier and Type | Method and Description |
---|---|
<X extends T> |
andThen(Iterator<X> other)
return a new iterator which delivers all the elements of this iterator and
then all the elements of the other iterator.
|
ExtendedIterator<T> |
filterDrop(Predicate<T> f)
return a new iterator containing only the elements of _this_ which
are rejected by the filter _f_.
|
ExtendedIterator<T> |
filterKeep(Predicate<T> f)
return a new iterator containing only the elements of _this_ which
pass the filter _f_.
|
<U> ExtendedIterator<U> |
mapWith(Function<T,U> map1)
return a new iterator where each element is the result of applying
_map1_ to the corresponding element of _this_.
|
default Optional<T> |
nextOptional()
Answer with an
Optional . |
T |
removeNext()
Answer the next object, and remove it.
|
List<T> |
toList()
Answer a list of the [remaining] elements of this iterator, in order,
consuming this iterator.
|
Set<T> |
toSet()
Answer a set of the [remaining] elements of this iterator,
consuming this iterator.
|
close
forEachRemaining, hasNext, next, remove
T removeNext()
<X extends T> ExtendedIterator<T> andThen(Iterator<X> other)
ExtendedIterator<T> filterKeep(Predicate<T> f)
ExtendedIterator<T> filterDrop(Predicate<T> f)
<U> ExtendedIterator<U> mapWith(Function<T,U> map1)
List<T> toList()
Set<T> toSet()
default Optional<T> nextOptional()
Optional
.
This operation assumes that the ExtendedIterator
does not return null for next()
.
If it does, NullPointerException
is thrown.
Optional.empty()
Optional
.
NullPointerException
Licenced under the Apache License, Version 2.0