Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Created February 27, 2015 00:47
Show Gist options
  • Save wrobstory/09494d12aa117d4ed320 to your computer and use it in GitHub Desktop.
Save wrobstory/09494d12aa117d4ed320 to your computer and use it in GitHub Desktop.
Scala getOrElse BS
scala> val foo = Map("one" -> "two")
foo: scala.collection.immutable.Map[String,String] = Map(one -> two)
scala> foo.getOrElse("nokey", None)
res67: java.io.Serializable = None
scala> foo.getOrElse("nokey", null)
res68: String = null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment