首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

scala的Option部类

2013-02-24 
scala的Option类型var s Some(abc)var t: Option[String] None def chooseFile(): Option[File] {

scala的Option类型
var s = Some("abc") var t: Option[String] = None def chooseFile(): Option[File] = { ... }//比较啰嗦的方式chooseFile() match { case Some(f) => case None => }//比较土的方式if (t isDefined) println(t)if (t isEmpty) println("Nothing here!")//比较简单的方式val w = t.getOrElse("Nothing here!")

?

?

热点排行