Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. sealed abstract class CustomOption[+A] {
  2. def empty: Boolean
  3. def getValue: A
  4. }
  5.  
  6. final case class Some[A](value: A) extends CustomOption[A] {
  7. def empty = false
  8. def getValue = value
  9. }
  10.  
  11. case object Nil extends CustomOption[Nothing] {
  12. def empty = true
  13. def getValue = throw new NoSuchElementException("Nil.getValue")
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement