Created
November 3, 2014 18:50
-
-
Save wrobstory/02aba72adfe6f279e160 to your computer and use it in GitHub Desktop.
Get & GetOrElse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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