Skip to content

Instantly share code, notes, and snippets.

@emmettna
Created January 20, 2020 04:25
Show Gist options
  • Save emmettna/807b53f41e2f2e99b9342e7cfd35bb80 to your computer and use it in GitHub Desktop.
Save emmettna/807b53f41e2f2e99b9342e7cfd35bb80 to your computer and use it in GitHub Desktop.
val list: List[Option[Int]] = List(Some(1), None, Some(2))
val result: List[Int]=list.map( numberOpt => numberOpt match {
case Some(v) => v
case None => 0
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment