memo
[code lang=text] scala> val a = "a" a: String = a
scala> Option(a) res13: Option[String] = Some(a)
scala> Option(a).exists(_ == "a") res14: Boolean = true
scala> Option(a).exists(_ == "b") res15: Boolean = false [/code]
ifをいれてみる
[code lang=text] scala> if (Option(a).exists(_ == "a")) | println("ok") ok
scala> if (Option(a).exists(_ == "b")) | println("ok")
scala> [/code]