Skip to content

Instantly share code, notes, and snippets.

@wrobstory
Created November 3, 2014 18:50
Show Gist options
  • Save wrobstory/02aba72adfe6f279e160 to your computer and use it in GitHub Desktop.
Save wrobstory/02aba72adfe6f279e160 to your computer and use it in GitHub Desktop.
Get & GetOrElse
// I don't find this behavior remarkably consistent
scala> foo.get("one")
res0: Option[Int] = Some(1)
scala> foo.getOrElse("one", 2)
res1: Int = 1
scala> foo.getOrElse("two", 2)
res2: Int = 2
scala> foo.get("two")
res3: Option[Int] = None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment