O'Reilly logo

Learning Java Functional Programming by Richard M Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Function Composition and Fluent Interfaces

Having discussed the nature of functions in Java 8, we will now focus on the various ways in which functions can be composed. By compose, we mean how they can be combined in interesting and powerful ways. These techniques include basic function composition and the use of fluent interfaces.

Function composition is concerned with combining two functions to form a third one. Using the output of one function as the input to another one is a common practice. By combining two such functions, we are able to create more complex functions, which can be reused.

We will examine the basic approach for composing functions and then move on to the use of the Function interface and its compose and andThen methods. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required