Projects anEither into aRight.
BecauseEither is already right-biased, this class is not normally needed. (It is retained in the library for now for easy cross-compilation between Scala 2.11 and 2.12.)
[Since version 2.13.0]Either is now right-biased, calls to `right` should be removedReturnsfalse ifLeft or returns the result of the application of the given function to theRight value.
Returnsfalse ifLeft or returns the result of the application of the given function to theRight value.
Right(12).right.exists(_ > 10) // trueRight(7).right.exists(_ > 10) // falseLeft(12).right.exists(_ > 10) // falseReturnsNone if this is aLeft or if the given predicatep does not hold for the right value, otherwise, returns aRight.
ReturnsNone if this is aLeft or if the given predicatep does not hold for the right value, otherwise, returns aRight.
Right(12).right.filterToOption(_ > 10) // Some(Right(12))Right(7).right.filterToOption(_ > 10) // NoneLeft(12).right.filterToOption(_ > 10) // NoneBinds the given function acrossRight.
Binds the given function acrossRight.
The function to bind acrossRight.
Returnstrue ifLeft or returns the result of the application of the given function to theRight value.
Returnstrue ifLeft or returns the result of the application of the given function to theRight value.
Right(12).right.forall(_ > 10) // trueRight(7).right.forall(_ > 10) // falseLeft(12).right.forall(_ > 10) // trueExecutes the given side-effecting function if this is aRight.
Executes the given side-effecting function if this is aRight.
Right(12).right.foreach(x => println(x)) // prints "12"Left(12).right.foreach(x => println(x)) // doesn't printThe side-effecting function to execute.
Returns the value from thisRight or the given argument if this is aLeft.
Returns the value from thisRight or the given argument if this is aLeft.
Right(12).right.getOrElse(17) // 12Left(12).right.getOrElse(17) // 17The given function is applied if this is aRight.
The given function is applied if this is aRight.
Right(12).right.map(x => "flower") // Result: Right("flower")Left(12).right.map(x => "flower") // Result: Left(12)Returns aSome containing theRight value if it exists or aNone if this is aLeft.
Returns aSome containing theRight value if it exists or aNone if this is aLeft.
Right(12).right.toOption // Some(12)Left(12).right.toOption // NoneReturns aSeq containing theRight value if it exists or an emptySeq if this is aLeft.
Returns aSeq containing theRight value if it exists or an emptySeq if this is aLeft.
Right(12).right.toSeq // Seq(12)Left(12).right.toSeq // Seq()ReturnsNone if this is aLeft or if the given predicatep does not hold for the right value, otherwise, returns aRight.
ReturnsNone if this is aLeft or if the given predicatep does not hold for the right value, otherwise, returns aRight.
Right(12).right.filter(_ > 10) // Some(Right(12))Right(7).right.filter(_ > 10) // NoneLeft(12).right.filter(_ > 10) // None[Since version 2.13.0]Use `filterToOption`, which more accurately reflects the return typeReturns the value from thisRight or throwsNoSuchElementException if this is aLeft.
Returns the value from thisRight or throwsNoSuchElementException if this is aLeft.
Right(12).right.get // 12Left(12).right.get // NoSuchElementExceptionNoSuchElementExceptionif the projection isLeft.
[Since version 2.13.0]Use `Either.toOption.get` insteadAn iterator over the names of all the elements of this product.
An iterator over the names of all the elements of this product.
An iterator over all the elements of this product.
An iterator over all the elements of this product.
in the default implementation, anIterator[Any]