I originally wrote a long introduction to this article, but I decided to keep that introduction for the second article in this series. For this article I’ll just say:
- idiomatic Scala code involves never using null values
- because you never use nulls, it’s important to become an expert at using
- initially you may want to use match expressions to handle
- as you become more proficient with Scala and Options, you’ll find that match expressions tend to be verbose
- becoming proficient with higher-order functions (HOFs) like map, filter, fold, and many others are the cure for that verbosity
Given that background, the purpose of this article is to show how to use HOFs with
Option values rather than match expressions.