scala

object Either

[source: scala/Either.scala]

object Either
extends AnyRef
Method Summary
def cond [A, B](test : Boolean, right : => B, left : => A) : Either[A, B] with Product
If the condition satisfies, return the given A in Left, otherwise, return the given B in Right.
def joinLeft [A, B](es : Either[Either[A, B], B]) : Either[A, B]
Joins an Either through Left.
def joinRight [A, B](es : Either[A, Either[A, B]]) : Either[A, B]
Joins an Either through Right.
def lefts [A, B](es : Iterable[Either[A, B]]) : List[A]
Returns the Left values in the given Iterable of Eithers.
def merge [T](e : Either[T, T]) : T
Takes an Either to its contained value within Left or Right.
def rights [A, B](es : Iterable[Either[A, B]]) : List[B]
Returns the Right values in the givenIterable of Eithers.
def separate [A, B](es : Iterable[Either[A, B]]) : (List[A], List[B])
Transforms an Iterable of Eithers into a pair of lists.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Class Summary
case final class LeftProjection [+A, +B](val e : Either[A, B]) extends Product
Projects an Either into a Left.
case final class RightProjection [+A, +B](val e : Either[A, B]) extends Product
Projects an Either into a Right.
Method Details
@deprecated("use `for (Left(a) <- es) yield a'")

def lefts[A, B](es : Iterable[Either[A, B]]) : List[A]
Returns the Left values in the given Iterable of Eithers.

@deprecated("use `for (Right(a) <- es) yield a'")

def rights[A, B](es : Iterable[Either[A, B]]) : List[B]
Returns the Right values in the givenIterable of Eithers.

@deprecated("use `for ((Left(l), Right(r)) <- es partition isLeft) yield (l, r)'")

def separate[A, B](es : Iterable[Either[A, B]]) : (List[A], List[B])
Transforms an Iterable of Eithers into a pair of lists.
Parameters
xs - the iterable of Eithers to separate
Returns
a pair of lists.

def joinLeft[A, B](es : Either[Either[A, B], B]) : Either[A, B]
Joins an Either through Left.

def joinRight[A, B](es : Either[A, Either[A, B]]) : Either[A, B]
Joins an Either through Right.

def merge[T](e : Either[T, T]) : T
Takes an Either to its contained value within Left or Right.

def cond[A, B](test : Boolean, right : => B, left : => A) : Either[A, B] with Product
If the condition satisfies, return the given A in Left, otherwise, return the given B in Right.