RightBiasedEither

final class RightBiasedEither[A, B] extends AnyVal
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def exists(f: B => Boolean): Boolean

Returns false if Left or returns the result of the application of the given function to the Right value.

Returns false if Left or returns the result of the application of the given function to the Right value.

Right(12).exists(_ > 10)  // true
Right(7).exists(_ > 10)   // false
Left(12).exists(_ > 10)   // false
def filter(f: B => Boolean): Option[Either[A, B]]

Returns None if this is a Left or if the given predicate p does not hold for the right value, otherwise, returns a Right.

Returns None if this is a Left or if the given predicate p does not hold for the right value, otherwise, returns a Right.

Right(12).filter(_ > 10) // Some(Right(12))
Right(7).filter(_ > 10)  // None
Left(12).filter(_ > 10)  // None
def flatMap[C](f: B => Either[A, C]): Either[A, C]

Binds the given function across Right.

Binds the given function across Right.

Value Params
f

The function to bind across Right.

def forall(f: B => Boolean): Boolean

Returns true if Left or returns the result of the application of the given function to the Right value.

Returns true if Left or returns the result of the application of the given function to the Right value.

Right(12).forall(_ > 10) // true
Right(7).forall(_ > 10)  // false
Left(12).forall(_ > 10)  // true
def foreach(f: B => Unit): Unit

Executes the given side-effecting function if this is a Right.

Executes the given side-effecting function if this is a Right.

Right(12).foreach(x => println(x)) // prints "12"
Left(12).foreach(x => println(x))  // doesn't print
Value Params
f

The side-effecting function to execute.

def getOrElse(or: => B): B
def leftFlatMap[C](f: A => Either[C, B]): Either[C, B]
def leftMap[C](f: A => C): Either[C, B]
def map[C](f: B => C): Either[A, C]

The given function is applied if this is a Right.

The given function is applied if this is a Right.

Right(12).map(x => "flower") // Result: Right("flower")
Left(12).map(x => "flower")  // Result: Left(12)
def toList: List[B]

Returns a List containing the Right value if it exists or an empty List if this is a Left.

Returns a List containing the Right value if it exists or an empty List if this is a Left.

Right(12).toList // List(12)
Left(12).toList // Nil
def toOption: Option[B]

Returns a Some containing the Right value if it exists or a None if this is a Left.

Returns a Some containing the Right value if it exists or a None if this is a Left.

Right(12).toOption // Some(12)
Left(12).toOption // None

Concrete fields

val e: Either[A, B]