scala.util.Either.RightProjection
Projects an Either
into a Right
.
This allows for-comprehensions over Either instances - for example
Continuing the analogy with scala.Option, a RightProjection
declares that
Right
should be analogous to Some
in some code.
Analogous to LeftProjection
, see example usage in its documentation above.
Instance Constructors From scala.util.Either.RightProjection
new RightProjection(e: Either[A, B])
(defined at scala.util.Either.RightProjection)
Value Members From scala.util.Either.RightProjection
val e: Either[A, B]
(defined at scala.util.Either.RightProjection)
def exists(p: (B) ⇒ Boolean): Boolean
Returns false
if Left
or returns the result of the application of the given
function to the Right
value.
(defined at scala.util.Either.RightProjection)
def filter[X](p: (B) ⇒ Boolean): Option[Either[X, 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
.
(defined at scala.util.Either.RightProjection)
def flatMap[AA >: A, Y](f: (B) ⇒ Either[AA, Y]): Either[AA, Y]
Binds the given function across Right
.
- f
- The function to bind across
Right
.
(defined at scala.util.Either.RightProjection)
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.
(defined at scala.util.Either.RightProjection)
def foreach[U](f: (B) ⇒ U): Any
Executes the given side-effecting function if this is a Right
.
- f
- The side-effecting function to execute.
(defined at scala.util.Either.RightProjection)
def getOrElse[BB >: B](or: ⇒ BB): BB
Returns the value from this Right
or the given argument if this is a Left
.
(defined at scala.util.Either.RightProjection)
def map[Y](f: (B) ⇒ Y): Either[A, Y]
The given function is applied if this is a Right
.
(defined at scala.util.Either.RightProjection)
def toSeq: collection.Seq[B]
Returns a Seq
containing the Right
value if it exists or an empty Seq
if
this is a Left
.
(defined at scala.util.Either.RightProjection)
Full Source: