Class Coalesce<L,R>
- java.lang.Object
-
- com.jnape.palatable.lambda.functions.builtin.fn1.Coalesce<L,R>
-
- Type Parameters:
L
- the left parameter typeR
- the right parameter type
- All Implemented Interfaces:
Fn1<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>>
,Applicative<Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<java.lang.Iterable<Either<L,R>>,?>>
,Cartesian<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<?,?>>
,Cocartesian<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<?,?>>
,Contravariant<java.lang.Iterable<Either<L,R>>,Profunctor<?,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<?,?>>>
,Functor<Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<java.lang.Iterable<Either<L,R>>,?>>
,Profunctor<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<?,?>>
,Monad<Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<java.lang.Iterable<Either<L,R>>,?>>
,MonadReader<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<java.lang.Iterable<Either<L,R>>,?>>
,MonadRec<Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<java.lang.Iterable<Either<L,R>>,?>>
,MonadWriter<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>,Fn1<java.lang.Iterable<Either<L,R>>,?>>
public final class Coalesce<L,R> extends java.lang.Object implements Fn1<java.lang.Iterable<Either<L,R>>,Either<java.lang.Iterable<L>,java.lang.Iterable<R>>>
Fold an
into anIterable
<Either
<L, R>>
, preserving all results of the side that's returned. That is, if the result is aEither
<Iterable
<L>,Iterable
<R>>left
, it will contain all left values; if it is aright
, it will contain all right values.It may be useful to think of this as a more efficient version of
.Merge
<Iterable
<L>,Iterable
<R>>
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Coalesce()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Either<java.lang.Iterable<L>,java.lang.Iterable<R>>
checkedApply(java.lang.Iterable<Either<L,R>> eithers)
Invoke this function with the given argument, potentially throwing anyThrowable
.static <A,B>
Coalesce<A,B>coalesce()
static <A,B>
Either<java.lang.Iterable<A>,java.lang.Iterable<B>>coalesce(java.lang.Iterable<Either<A,B>> eithers)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Field Detail
-
INSTANCE
private static final Coalesce<?,?> INSTANCE
-
-
Method Detail
-
checkedApply
public Either<java.lang.Iterable<L>,java.lang.Iterable<R>> checkedApply(java.lang.Iterable<Either<L,R>> eithers)
Description copied from interface:Fn1
Invoke this function with the given argument, potentially throwing anyThrowable
.- Specified by:
checkedApply
in interfaceFn1<L,R>
- Parameters:
eithers
- the argument- Returns:
- the result of the function application
-
coalesce
public static <A,B> Coalesce<A,B> coalesce()
-
-