Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sealed abstract class CustomOption[+A] {
- def empty: Boolean
- def getValue: A
- }
- final case class Some[A](value: A) extends CustomOption[A] {
- def empty = false
- def getValue = value
- }
- case object Nil extends CustomOption[Nothing] {
- def empty = true
- def getValue = throw new NoSuchElementException("Nil.getValue")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement