Using Option

The Scala Option type is an algebraic data type (ADT) that represents an optional value. It can also be viewed as List that can contain either one or no elements. It is a safe replacement for a null reference that you might have used if you have programmed in Java, C++, or C#.