by shigemk2

当面は技術的なことしか書かない

Scala isDefined

Just like this. See this sample.

scala> val a = Some("hoge")
a: Some[String] = Some(hoge)

scala> a.get
res0: String = hoge

scala> val b = None
b: None.type = None

scala> b.isDefined
res1: Boolean = false

scala> a.isDefined
res2: Boolean = true

scala> a.isEmpty
res3: Boolean = false

scala> b.isEmpty
res4: Boolean = true

blog.originate.com