Payload - The payload type.public final class FilteredIterator<Payload> extends Object implements Iterator<Payload>
FilteredIterator is an Iterator that can be wrapped around
a given Iterator and filters out values according to a given
Predicate.
Calling next() will never return a value that
doesn't satisfy the given Predicate and calling
hasNext() will never return true, unless
a value that satisfies the given Predicate is available.
| Constructor and Description |
|---|
FilteredIterator(Iterator<? extends Payload> iterator,
Predicate<? super Payload> predicate)
Creates a new
FilteredIterator. |
FilteredIterator(Iterator<? extends Payload> iterator,
Predicate<? super Payload> predicate,
boolean invertPredicate)
Creates a new
FilteredIterator. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
Payload |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic FilteredIterator(Iterator<? extends Payload> iterator, Predicate<? super Payload> predicate) throws IllegalArgumentException
FilteredIterator.iterator - The Iterator to iterate over.predicate - The Predicate to be used.IllegalArgumentException - If the given Iterator is null or if the
given Predicate is null.public FilteredIterator(Iterator<? extends Payload> iterator, Predicate<? super Payload> predicate, boolean invertPredicate) throws IllegalArgumentException
FilteredIterator.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.