Projects anEither into aLeft.
Returnsfalse ifRight or returns the result of the application of the given function to theLeft value.
Returnsfalse ifRight or returns the result of the application of the given function to theLeft value.
Left(12).left.exists(_ > 10) // trueLeft(7).left.exists(_ > 10) // falseRight(12).left.exists(_ > 10) // falseReturnsNone if this is aRight or if the given predicatep does not hold for the left value, otherwise, returns aLeft.
ReturnsNone if this is aRight or if the given predicatep does not hold for the left value, otherwise, returns aLeft.
Left(12).left.filterToOption(_ > 10) // Some(Left(12))Left(7).left.filterToOption(_ > 10) // NoneRight(12).left.filterToOption(_ > 10) // NoneBinds the given function acrossLeft.
Binds the given function acrossLeft.
Left(12).left.flatMap(x => Left("scala")) // Left("scala")Right(12).left.flatMap(x => Left("scala")) // Right(12)The function to bind acrossLeft.
Returnstrue ifRight or returns the result of the application of the given function to theLeft value.
Returnstrue ifRight or returns the result of the application of the given function to theLeft value.
Left(12).left.forall(_ > 10) // trueLeft(7).left.forall(_ > 10) // falseRight(12).left.forall(_ > 10) // trueExecutes the given side-effecting function if this is aLeft.
Executes the given side-effecting function if this is aLeft.
Left(12).left.foreach(x => println(x)) // prints "12"Right(12).left.foreach(x => println(x)) // doesn't printThe side-effecting function to execute.
Returns the value from thisLeft or the given argument if this is aRight.
Returns the value from thisLeft or the given argument if this is aRight.
Left(12).left.getOrElse(17) // 12Right(12).left.getOrElse(17) // 17Maps the function argument throughLeft.
Maps the function argument throughLeft.
Left(12).left.map(_ + 2) // Left(14)Right[Int, Int](12).left.map(_ + 2) // Right(12)Returns aSome containing theLeft value if it exists or aNone if this is aRight.
Returns aSome containing theLeft value if it exists or aNone if this is aRight.
Left(12).left.toOption // Some(12)Right(12).left.toOption // NoneReturns aSeq containing theLeft value if it exists or an emptySeq if this is aRight.
Returns aSeq containing theLeft value if it exists or an emptySeq if this is aRight.
Left(12).left.toSeq // Seq(12)Right(12).left.toSeq // Seq()ReturnsNone if this is aRight or if the given predicatep does not hold for the left value, otherwise, returns aLeft.
ReturnsNone if this is aRight or if the given predicatep does not hold for the left value, otherwise, returns aLeft.
Left(12).left.filter(_ > 10) // Some(Left(12))Left(7).left.filter(_ > 10) // NoneRight(12).left.filter(_ > 10) // None[Since version 2.13.0]Use `filterToOption`, which more accurately reflects the return typeReturns the value from thisLeft or throwsNoSuchElementException if this is aRight.
Returns the value from thisLeft or throwsNoSuchElementException if this is aRight.
Left(12).left.get // 12Right(12).left.get // NoSuchElementExceptionNoSuchElementExceptionif the projection isscala.util.Right
[Since version 2.13.0]use `Either.swap.getOrElse` 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]