scala - How to transform Seq[Option[A]] into Seq[A]? -
i want filter seq
some
alternative types, , extract contents.
is there single function phone call this?
val list = optionlist.flatmap(_.tolist)
as sschaef points out in comments, can utilize flatten
:
val list = optionlist.flatten
scala
No comments:
Post a Comment