Skip to content

Instantly share code, notes, and snippets.

@flazz
Created September 14, 2012 19:44
Show Gist options
  • Save flazz/3724255 to your computer and use it in GitHub Desktop.
Save flazz/3724255 to your computer and use it in GitHub Desktop.
null into vals
package example
object NullThing {
implicit def thing2option[A](x:A) = Option(x)
def main(args: Array[String]) {
val a: Option[Int] = null
val b: Option[Int] = Some(5)
Console.println(a) // null
Console.println(b) // Some(5)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment