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. ...
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