Payload - The payload type.public final class FilteringIterator<Payload> extends Object implements Iterator<Payload>
FilteringIterator 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 |
|---|
FilteringIterator(Iterator<? extends Payload> iterator,
Predicate<Payload> predicate)
|
FilteringIterator(Iterator<? extends Payload> iterator,
Predicate<Payload> predicate,
boolean invertPredicate)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext() |
Payload |
next() |
void |
remove() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEachRemainingpublic FilteringIterator(Iterator<? extends Payload> iterator, Predicate<Payload> predicate) throws IllegalArgumentException
iterator - The Iterator, around which the new
NullFreeIterator will be wrapped.predicate - The Predicate to test
every value yielded by the given Iterator with.IllegalArgumentException - If the given Iterator is null or if the
given Predicate is null.public FilteringIterator(Iterator<? extends Payload> iterator, Predicate<Payload> predicate, boolean invertPredicate) throws IllegalArgumentException
iterator - The Iterator, around which the new
NullFreeIterator will be wrapped.predicate - The Predicate to test
every value yielded by the given Iterator with.invertPredicate - Whether to invert the test result and yield values that don't
satisfy the given Predicate.IllegalArgumentException - If the given Iterator is null or if the
given Predicate is null.Copyright © 2015–2016 Markenwerk – Gesellschaft für markenbildende Maßnahmen mbH. All rights reserved.