Last active
November 29, 2018 02:13
-
-
Save kmizu/f774b3c2990ace18be7d4c5f6ba8e72d to your computer and use it in GitHub Desktop.
ScalaとJavaの境界におけるnullの扱い方 ref: https://qiita.com/kmizu/items/e4c7473f9ed831b5a1de
This file contains 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
import java.util | |
def useMap(config: util.Map[String, String]): Unit = { | |
// "version" に対応する値が必ずあるとわかっているとする | |
val version = config.get("version") | |
... | |
} |
This file contains 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
import java.util | |
def useMap(config: util.Map[String, String]): Unit = { | |
assert(config.containsKey("version")) | |
val version: String = config.get("version") | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment