Created
January 20, 2020 04:25
-
-
Save emmettna/807b53f41e2f2e99b9342e7cfd35bb80 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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