By Alvin Alexander. Last updated: February 17, 2020
This image comes from this article. It shows a nice way to use map
instead of match/case when processing an Option
in Scala, and also shows a fold
approach.
For many more ways to work with an Option and higher-order functions, see my tutorial, How to use higher-order functions with Option (instead of using match expressions).