Skip to content

Instantly share code, notes, and snippets.

@jpfuentes2
Created January 2, 2015 22:42
Show Gist options
  • Save jpfuentes2/b7b4576b2cf678dcbb35 to your computer and use it in GitHub Desktop.
Save jpfuentes2/b7b4576b2cf678dcbb35 to your computer and use it in GitHub Desktop.
scala> val x: Option[String] = Option[String](null)
x: Option[String] = None
scala> x.isDefined
res0: Boolean = false
scala> x.getOrElse("foo")
res1: String = foo
scala> x.map(_.length)
res2: Option[Int] = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment