您的位置:首页 > 其它

scala总结(3)-- scala中常用类型继承关系

2015-01-21 11:23 197 查看
上图:



in Scala
Nothing will be used for all null like use cases

Option: either Some or None
典型应用: Map中get方法返回Option:
scores.get(“Alice”) match {
case Some(score) => println(“score: ” + score)
case None => println(“no score")
}
等价于 scores.getOrElse(“no score")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  scala