If I have something like a List[Option[A]] and I want to convert this into a List[A], the standard way is to use flatMap:
List[Option[A]]
List[A]
flatMap
You could just give the type inferencer a little help:
scala> val l = List(Some("Hello"), None, Some("World")) l: List[Option[java.lang.String]] = List(Some(Hello), None, Some(World)) scala> l.flatten[String] res0: List[String] = List(Hello, World)