public abstract class LazyIterator<T> extends NiceIterator<T>
iterator1.andThen(iterator2)
you could implement iterator2 as a LazyIterator.
The sequence to be defined is defined by the subclass's definition
of create()
. That is called exactly once on the first attempt
to iterate (i.e. use one of the hasNext
, next
,
remove
, removeNext
operations,
maybe indirectly via toList
).Constructor and Description |
---|
LazyIterator()
An ExtendedIterator that is created lazily.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
default close: don't need to do anything.
|
abstract ExtendedIterator<T> |
create()
The subclass must define this to return
the ExtendedIterator to invoke.
|
boolean |
hasNext()
default hasNext: no elements, return false.
|
T |
next()
default next: throw an exception.
|
void |
remove()
default remove: we have no elements, so we can't remove any.
|
andThen, andThen, asList, asSet, close, emptyIterator, filterDrop, filterKeep, mapWith, removeNext, toList, toSet
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextOptional
forEachRemaining
public LazyIterator()
public boolean hasNext()
NiceIterator
public T next()
NiceIterator
public void remove()
NiceIterator
public void close()
NiceIterator
close
in interface ClosableIterator<T>
close
in class NiceIterator<T>
public abstract ExtendedIterator<T> create()
Licenced under the Apache License, Version 2.0