Payload - The payload type.public final class NullSaveIterator<Payload> extends Object implements Iterator<Payload>
NullSaveIterator is an Iterator that can be wrapped around
a given Iterator and always behaves correctly, even if the given
Iterator is null (by behaving like an
EmptyIterator).
Calling any of the methods declared by Iterator will be relayed to
the given Iterator, if present.
For convenience, it is possible to constuct a NullSaveIterator from
an Iterable even if the given Iterable is null.
| Constructor and Description |
|---|
NullSaveIterator(Iterable<Payload> iterable)
Creates a new
NullSaveIterator from the given Iterable. |
NullSaveIterator(Iterator<Payload> iterator)
Creates a new
NullSaveIterator from the given Iterator. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
Payload |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic NullSaveIterator(Iterable<Payload> iterable)
NullSaveIterator from the given Iterable.iterable - The Iterable to obtain an Iterator from,
around which the new NullSaveIterator will be wrapped,
or null.public NullSaveIterator(Iterator<Payload> iterator)
NullSaveIterator from the given Iterator.iterator - The Iterator, around which the new
NullSaveIterator will be wrapped, or null.Copyright © 2015–2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.