Class

scala.util

Right

Related Doc: package util

Permalink

final case class Right[+A, +B](b: B) extends Either[A, B] with Product with Serializable

The right side of the disjoint union, as opposed to the scala.util.Left side.

Version

1.0, 11/10/2008

Linear Supertypes
Serializable, java.io.Serializable, Product, Equals, Either[A, B], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Right
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. Either
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Right(b: B)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. val b: B

    Permalink
  6. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. def fold[X](fa: (A) ⇒ X, fb: (B) ⇒ X): X

    Permalink

    Applies fa if this is a Left or fb if this is a Right.

    Applies fa if this is a Left or fb if this is a Right.

    fa

    the function to apply if this is a Left

    fb

    the function to apply if this is a Right

    returns

    the results of applying the function

    Definition Classes
    Either
    Example:
    1. val result: Either[Exception, Value] = possiblyFailingOperation()
      log(result.fold(
        ex => "Operation failed with " + ex,
        v => "Operation produced value: " + v
      ))
  10. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  12. def isLeft: Boolean

    Permalink

    Returns true if this is a Left, false otherwise.

    Returns true if this is a Left, false otherwise.

    Left("tulip").isLeft // true
    Right("venus fly-trap").isLeft // false
    Definition Classes
    RightEither
  13. def isRight: Boolean

    Permalink

    Returns true if this is a Right, false otherwise.

    Returns true if this is a Right, false otherwise.

    Left("tulip").isRight // false
    Right("venus fly-trap").isRight // true
    Definition Classes
    RightEither
  14. def joinLeft[A1 >: A, B1 >: B, C](implicit ev: <:<[A1, Either[C, B1]]): Either[C, B1]

    Permalink

    Joins an Either through Left.

    Joins an Either through Left.

    This method requires that the left side of this Either is itself an Either type. That is, this must be some type like:

    Either[Either[C, B], B]

    (which respects the type parameter bounds, shown below.)

    If this instance is a Left[Either[C, B]] then the contained Either[C, B] will be returned, otherwise this value will be returned unmodified.

    Left[Either[Int, String], String](Right("flower")).joinLeft // Result: Right("flower")
    Left[Either[Int, String], String](Left(12)).joinLeft // Result: Left(12)
    Right[Either[Int, String], String]("daisy").joinLeft // Result: Right("daisy")

    This method, and joinRight, are analogous to Option#flatten

    Definition Classes
    Either
  15. def joinRight[A1 >: A, B1 >: B, C](implicit ev: <:<[B1, Either[A1, C]]): Either[A1, C]

    Permalink

    Joins an Either through Right.

    Joins an Either through Right.

    This method requires that the right side of this Either is itself an Either type. That is, this must be some type like:

    Either[A, Either[A, C]]

    (which respects the type parameter bounds, shown below.)

    If this instance is a Right[Either[A, C]] then the contained Either[A, C] will be returned, otherwise this value will be returned unmodified.

    Definition Classes
    Either
    Example:
    1. Right[String, Either[String, Int]](Right(12)).joinRight // Result: Right(12)
      Right[String, Either[String, Int]](Left("flower")).joinRight // Result: Left("flower")
      Left[String, Either[String, Int]]("flower").joinRight // Result: Left("flower")

      This method, and joinLeft, are analogous to Option#flatten

  16. def left: LeftProjection[A, B]

    Permalink

    Projects this Either as a Left.

    Projects this Either as a Left.

    Definition Classes
    Either
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. def right: RightProjection[A, B]

    Permalink

    Projects this Either as a Right.

    Projects this Either as a Right.

    Definition Classes
    Either
  21. def swap: Product with Serializable with Either[B, A]

    Permalink

    If this is a Left, then return the left value in Right or vice versa.

    If this is a Left, then return the left value in Right or vice versa.

    Definition Classes
    Either
    Example:
    1. val l: Either[String, Int] = Left("left")
      val r: Either[Int, String] = l.swap // Result: Right("left")
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from java.io.Serializable

Inherited from Product

Inherited from Equals

Inherited from Either[A, B]

Inherited from AnyRef

Inherited from Any

Ungrouped