The Option type is used frequently in Scala programs, and you can compare this with the null value available in Java, which indicates no value. Scala Option [T] is a container for zero or one element for a given type. An Option [T] can be either a Some [T] or None object, which represents a missing value. For instance, the get method of Scala's Map produces Some (value) if a value corresponding to a given key has been found, or None if the given key is not defined in the Map.
The basic trait for an Option looks like this:
trait Option[T] { def get: A // Returns the option's value. def isEmpty: Boolean // Returns true if the option is None, false otherwise. def productArity: Int // The size of this product. For a product A(x_1, ..., ...