July 2023
Intermediate to advanced
276 pages
6h 55m
English
We’ve been looking at the internals of methods and classes in this chapter. Now let’s shift our focus to see how lambda expressions can help shape a class’s skin or interface. We can use these techniques to structure the API of our classes to make it more intuitive and fluent for programmers to use.
Let’s start with a simple Mailer class and evolve the design of its interface.
| | public class Mailer { |
| | public void from(final String address) { /*... */ } |
| | public void to(final String address) { /*... */ } |
| | public void subject(final String line) { /*... */ } |
| | public void body(final String message) { |
Read now
Unlock full access