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!")
?
?