Summary
In this chapter, we looked at two very important concepts in Scala, namely pattern matching and partial functions. We saw many examples where pattern matching comes handy, and its application to get the double dispatch works for us. We implemented the chain of responsibilities design pattern in Java. Partial functions are a very useful concept in their own right, and we saw how to implement the chain of responsibilities using partial functions in Scala. Along the way, we looked at the collect functions. The stage is set now for you to get into the thick of functional programming. We have already briefly touched upon the theme of composition and how to create a pipeline. In the upcoming chapter, we will see various functional combinators ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access