Scala Library
|
|
scala/Either.scala
]
object
Either
extends
AnyRefMethod Summary | |
def
|
cond
[A, B](test : Boolean, right : => B, left : => A) : Either[A, B]
If the condition satisfies, return the given A in
Left ,
otherwise, return the given B in Right . |
implicit def
|
either2mergeable [A](x : Either[A, A]) : MergeableEither[A] |
def
|
joinLeft [A, B](es : Either[Either[A, B], B]) : Either[A, B] |
def
|
joinRight [A, B](es : Either[A, Either[A, B]]) : Either[A, B] |
def
|
lefts
[A, B](es : Iterable[Either[A, B]]) : List[A]
Returns the
Left values in the given Iterable of Either s. |
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 Either s. |
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 . |
class
|
MergeableEither
[A](x : Either[A, A]) extends AnyRef
|
case final class
|
RightProjection
[+A, +B](val e : Either[A, B]) extends Product
Projects an
Either into a Right . |
Method Details |
implicit
def
either2mergeable[A](x : Either[A, A]) : MergeableEither[A]
def
merge[T](e : Either[T, T]) : T
Either
to its contained value within Left
or
Right
.
def
lefts[A, B](es : Iterable[Either[A, B]]) : List[A]
Left
values in the given Iterable
of Either
s.
def
rights[A, B](es : Iterable[Either[A, B]]) : List[B]
Right
values in the givenIterable
of Either
s.
def
separate[A, B](es : Iterable[Either[A, B]]) : (List[A], List[B])
xs -
the iterable of Eithers to separateLeft
,
otherwise, return the given B in Right
.
Scala Library
|
|