OptionOps

final
class OptionOps[A](self: Option[A]) extends AnyVal
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

final
def <\/[B](b: => B): A \/ B
final
def \/>[E](e: => E): E \/ A
final
def cata[X](some: A => X, none: => X): X
final
def err(message: => String): A

Returns the item contained in the Option if it is defined, otherwise, raises an error with the provided message.

Returns the item contained in the Option if it is defined, otherwise, raises an error with the provided message.

final
def first: Option[A] @@ First
final
def foldLift[F[_] : Applicative, B](b: => B, k: F[A] => B): B
final
def foldLiftOpt[B](b: => B, k: Option[A] => B): B
final
def getOrElseF[F[_] : Applicative](fa: => F[A]): F[A]
final
def last: Option[A] @@ Last
final
def orEmpty[M[_] : PlusEmpty]: M[A]
final
def orZero(implicit z: Monoid[A]): A
final
def toFailure[B](b: => B): Validation[A, B]
final
def toFailureNel[B](b: => B): ValidationNel[A, B]
final
def toIList: IList[A]
final
def toLeftDisjunction[B](b: => B): A \/ B
final
def toMaybe: Maybe[A]
final
def toRightDisjunction[E](e: => E): E \/ A
final
def toSuccess[E](e: => E): Validation[E, A]
final
def toSuccessNel[E](e: => E): ValidationNel[E, A]
final
def unary_~(implicit z: Monoid[A]): A

Returns the item contained in the Option if it is defined, otherwise, the zero element for the type A

Returns the item contained in the Option if it is defined, otherwise, the zero element for the type A

For example:

val o: Option[List[String]] = None
val a: List[String] = ~o // List()
final
def |(a: => A): A

Returns the item contained in the Option if it is defined, otherwise, the provided argument.

Returns the item contained in the Option if it is defined, otherwise, the provided argument.