com.jnape.palatable.lambda.functions.builtin.fn1

## Class Coalesce<L,R>

- java.lang.Object
- - com.jnape.palatable.lambda.functions.builtin.fn1.Coalesce<L,R>

- Type Parameters:
    `L` - the left parameter type
    `R` - the right parameter type
  All Implemented Interfaces:
    Fn1<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>>, Applicative<Either<Iterable<L>,Iterable<R>>,Fn1<Iterable<Either<L,R>>,?>>, Cartesian<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>,Fn1<?,?>>, Cocartesian<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>,Fn1<?,?>>, Contravariant<Iterable<Either<L,R>>,Profunctor<?,Either<Iterable<L>,Iterable<R>>,Fn1<?,?>>>, Functor<Either<Iterable<L>,Iterable<R>>,Fn1<Iterable<Either<L,R>>,?>>, Profunctor<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>,Fn1<?,?>>, Monad<Either<Iterable<L>,Iterable<R>>,Fn1<Iterable<Either<L,R>>,?>>, MonadReader<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>,Fn1<Iterable<Either<L,R>>,?>>, MonadRec<Either<Iterable<L>,Iterable<R>>,Fn1<Iterable<Either<L,R>>,?>>, MonadWriter<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>,Fn1<Iterable<Either<L,R>>,?>>

      public final class Coalesce<L,R>
      extends Object
      implements Fn1<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>>

  Fold an ``Iterable`<`Either`<L, R>>` into an ``Either`<`Iterable`<L>, `Iterable`<R>>`, preserving all results of the side that's returned. That is, if the result is a `left`, it will contain all left values; if it is a `right`, 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>>`.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Either<Iterable<L>,Iterable<R>>` | `checkedApply(Iterable<Either<L,R>> eithers)` Invoke this function with the given argument, potentially throwing any `Throwable`.
    `static <A,B> Coalesce<A,B>` | `coalesce()`
    `static <A,B> Either<Iterable<A>,Iterable<B>>` | `coalesce(Iterable<Either<A,B>> eithers)`

    - ### 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, apply, carry, cartesian, censor, choose, cocartesian, compose, contraMap, diMap, diMapL, diMapR, discardL, discardR, flatMap, fmap, fn1, fromFunction, lazyZip, listens, local, pure, pureFn1, thunk, toFunction, trampolineM, widen, zip, zip`

    - ### Methods inherited from interface com.jnape.palatable.lambda.monad.Monad

      `join`

    - ### Methods inherited from interface com.jnape.palatable.lambda.functor.Functor

      `coerce`

- - ### Method Detail

    - #### checkedApply

          public Either<Iterable<L>,Iterable<R>> checkedApply(Iterable<Either<L,R>> eithers)

      Description copied from interface: `Fn1`
      Invoke this function with the given argument, potentially throwing any `Throwable`.
      Specified by:
        `checkedApply` in interface `Fn1<Iterable<Either<L,R>>,Either<Iterable<L>,Iterable<R>>>`
      Parameters:
        `eithers` - the argument
      Returns:
        the result of the function application

    - #### coalesce

          public static <A,B> Coalesce<A,B> coalesce()

    - #### coalesce

          public static <A,B> Either<Iterable<A>,Iterable<B>> coalesce(Iterable<Either<A,B>> eithers)