Class Find<A>
java.lang.Object
com.jnape.palatable.lambda.functions.builtin.fn2.Find<A>
- Type Parameters:
A
- the Iterable element type
- All Implemented Interfaces:
Fn1<Fn1<? super A,
,? extends Boolean>, Fn1<Iterable<A>, Maybe<A>>> Fn2<Fn1<? super A,
,? extends Boolean>, Iterable<A>, Maybe<A>> Applicative<Fn1<Iterable<A>,
,Maybe<A>>, Fn1<Fn1<? super A, ? extends Boolean>, ?>> Cartesian<Fn1<? super A,
,? extends Boolean>, Fn1<Iterable<A>, Maybe<A>>, Fn1<?, ?>> Cocartesian<Fn1<? super A,
,? extends Boolean>, Fn1<Iterable<A>, Maybe<A>>, Fn1<?, ?>> Contravariant<Fn1<? super A,
,? extends Boolean>, Profunctor<?, Fn1<Iterable<A>, Maybe<A>>, Fn1<?, ?>>> Functor<Fn1<Iterable<A>,
,Maybe<A>>, Fn1<Fn1<? super A, ? extends Boolean>, ?>> Profunctor<Fn1<? super A,
,? extends Boolean>, Fn1<Iterable<A>, Maybe<A>>, Fn1<?, ?>> Monad<Fn1<Iterable<A>,
,Maybe<A>>, Fn1<Fn1<? super A, ? extends Boolean>, ?>> MonadReader<Fn1<? super A,
,? extends Boolean>, Fn1<Iterable<A>, Maybe<A>>, Fn1<Fn1<? super A, ? extends Boolean>, ?>> MonadRec<Fn1<Iterable<A>,
,Maybe<A>>, Fn1<Fn1<? super A, ? extends Boolean>, ?>> MonadWriter<Fn1<? super A,
? extends Boolean>, Fn1<Iterable<A>, Maybe<A>>, Fn1<Fn1<? super A, ? extends Boolean>, ?>>
public final class Find<A>
extends Object
implements Fn2<Fn1<? super A,? extends Boolean>,Iterable<A>,Maybe<A>>
Iterate the elements in an
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.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.jnape.palatable.lambda.functions.Fn1
andThen, carry, cartesian, censor, choose, cocartesian, diMap, diMapR, discardL, flatMap, fmap, lazyZip, listens, local, pure, self, thunk, toFunction, trampolineM, zip, zip