Skip to content

Instantly share code, notes, and snippets.

@eamelink
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eamelink/c07b23dce4747414c471 to your computer and use it in GitHub Desktop.
Save eamelink/c07b23dce4747414c471 to your computer and use it in GitHub Desktop.
case class Nine private(inner: String)
object Nine {
def apply(value: String): Option[Nine] =
if(value.last == "9") Some(new Nine(value)) else None
}
val x = Nine("123") // None
val y = Nine("789") // Some(Nine("789"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment