Skip to content

Instantly share code, notes, and snippets.

@tomaszperek
Last active Aug 29, 2015
Embed
What would you like to do?
sealed abstract class Option[+A] extends Product with Serializable {
...
}
final case class Some[+A](x: A) extends Option[A] {
def isEmpty = false
def get = x
}
case object None extends Option[Nothing] {
def isEmpty = true
def get = throw new NoSuchElementException("None.get")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment