public class WrappedIterator<T> extends NiceIterator<T>
Modifier and Type | Method and Description |
---|---|
void |
close()
close: defer to the base, iff it is closable
|
static void |
close(Iterator<?> it)
if
it is a Closableiterator, close it. |
static <T> ExtendedIterator<T> |
create(Iterator<T> it)
Answer an ExtendedIterator returning the elements of
it . |
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 round
it which does not
permit .remove() even if it does. |
Iterator<? extends T> |
forTestingOnly_getBase() |
boolean |
hasNext()
hasNext: defer to the base iterator
|
T |
next()
next: defer to the base iterator
|
void |
remove()
if .remove() is allowed, delegate to the base iterator's .remove;
otherwise, throw an UnsupportedOperationException.
|
andThen, andThen, asList, asSet, emptyIterator, filterDrop, filterKeep, mapWith, removeNext, toList, toSet
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
nextOptional
forEachRemaining
public static <T> ExtendedIterator<T> create(Iterator<T> it)
it
.
If it
is itself an ExtendedIterator, return that; otherwise
wrap it
.public static <T> WrappedIterator<T> createNoRemove(Iterator<T> it)
it
which does not
permit .remove()
even if it
does.public static <T> ExtendedIterator<T> createIteratorIterator(Iterator<Iterator<T>> it)
public boolean hasNext()
public T next()
public void remove()
public void close()
close
in interface ClosableIterator<T>
close
in class NiceIterator<T>
public static void close(Iterator<?> it)
it
is a Closableiterator, close it. Abstracts away from
tests [that were] scattered through the code.Licenced under the Apache License, Version 2.0