public final class DiggPredicates extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Predicate<T> |
nth(long n,
Predicate<T> predicate)
Create a new predicate which only yields true on the nth
true-yielding invocation of a given predicate. |
public static <T> Predicate<T> nth(long n, Predicate<T> predicate)
true-yielding invocation of a given predicate.
As this is a stateful predicate, it should usually not be kept as a
reference, but used inline when processing a number of elements,
with streams.
n - the nth true-yielding invocation, 1 indicates first,
2 second, and so forth. 0 or less will throw an
IllegalArgumentException.predicate - the predicate.Copyright © 2016 Digipost. All rights reserved.