Say I have a val s: Option[Option[String]]
. It can thus have the following values:
Some(Some(\"foo\"))
Some(None)
None
Well, I actually don't understand how come it could be just None (the third case). If it can really be also just None, then I would vote for Rex Kerr's answer, otherwise just .get would be enough:
scala> Some(Some("foo")).get
res0: Some[java.lang.String] = Some(foo)
scala> Some(None).get
res1: None.type = None