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 construct a NullSaveIterator from
an Iterable even if the given Iterable is null.
| Constructor and Description |
|---|
NullSaveIterator(Iterable<? extends Payload> iterable)
Creates a new
NullSaveIterator. |
NullSaveIterator(Iterator<? extends Payload> iterator)
Creates a new
NullSaveIterator. |
| 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<? extends Payload> iterable)
NullSaveIterator.public NullSaveIterator(Iterator<? extends Payload> iterator)
NullSaveIterator.iterator - The Iterator to iterate over.public Payload next() throws NoSuchElementException
next in interface Iterator<Payload>NoSuchElementExceptionpublic void remove()
throws IllegalStateException,
UnsupportedOperationException
remove in interface Iterator<Payload>IllegalStateExceptionUnsupportedOperationExceptionCopyright © 2015–2017 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.