Option

object Option
Companion
class
Source
Option.scala
trait Sum
trait Mirror
class Object
trait Matchable
class Any

Type members

Inherited types

The names of the product elements

Inherited from
Mirror

The name of the type

Inherited from
Mirror

Value members

Concrete methods

def apply[A](x: A): Option[A]

An Option factory which creates Some(x) if the argument is not null, and None if it is null.

Value Params
x

the value

Returns

Some(value) if value != null, None if value == null

Source
Option.scala
def empty[A]: Option[A]

An Option factory which returns None in a manner consistent with the collections hierarchy.

def unless[A](cond: Boolean)(a: => A): Option[A]

Unless a given condition is true, this will evaluate the a argument and return Some(a). Otherwise, a is not evaluated and None is returned.

def when[A](cond: Boolean)(a: => A): Option[A]

When a given condition is true, evaluates the a argument and returns Some(a). When the condition is false, a is not evaluated and None is returned.

Implicits

Implicits

implicit def option2Iterable[A](xo: Option[A]): Iterable[A]

An implicit conversion that converts an option to an iterable value