Say I have a val s: Option[Option[String]]. It can thus have the following values:
val s: Option[Option[String]]
Some(Some(\"foo\")) Some(None) None
Some(Some(\"foo\"))
Some(None)
None
I think the conversion to the Iterable is just fine. Use these steps to go from Option[Option[String] to a single Option[String]
Option[Option[String]
Option[String]
s.flatten.headOption
(which returns Option[String])