A
- the Iterable element typepublic final class Find<A> extends Object implements Fn2<Fn1<? super A,? extends Boolean>,Iterable<A>,Maybe<A>>
Iterable
, applying a predicate to each one, returning the first element that
matches the predicate, wrapped in a Maybe
. If no elements match the predicate, the result is
Maybe.nothing()
. This function short-circuits, and so is safe to use on potentially infinite Iterable
instances that guarantee to have an eventually matching element.Modifier and Type | Method and Description |
---|---|
Maybe<A> |
checkedApply(Fn1<? super A,? extends Boolean> predicate,
Iterable<A> as) |
static <A> Find<A> |
find() |
static <A> Fn1<Iterable<A>,Maybe<A>> |
find(Fn1<? super A,? extends Boolean> predicate) |
static <A> Maybe<A> |
find(Fn1<? super A,? extends Boolean> predicate,
Iterable<A> as) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
apply, apply, checkedApply, compose, contraMap, curried, curry, diMapL, discardR, flip, fn2, fromBiFunction, toBiFunction, uncurry, widen