Summary
We examined how the functional programming features of Java can simplify the implementation of object-oriented design patterns. Lambda expressions were used as an alternate means of expression functionality. Streams allowed us to combine operations. Functional interfaces and default methods allowed us to reduce the amount of coding required to implement a solution. However, functional interfaces can limit how problems can be addressed since it supports a single abstract method.
We looked specifically at the execute-around-method, factory, command, strategy, visitor, and visitor patterns. Each of these patterns is designed to address a specific problem. An object-oriented approach was presented and then followed up with a functional solution.
In the next chapter, we will discuss how IDEs can provide support for refactoring object-oriented code to a functional approach, how to debug lambda expressions, and how the functional implementations can be tested.