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

Fluent interfaces

Fluent interfaces provide a convenient and easy-to-use technique for expressing solutions to many different types of problems. They are similar to method chaining but are more natural to use. It is a form of function composition where the method invocations are chained together. In this section, we will discuss the difference and similarities between method chaining, method cascading, and fluent interfaces.

Java supported fluent styles before Java 8 though their use was not common. For example, in JavaFX 2 the IntegerProperty class possesses a number of numerical methods that return the NumberBinding instances. These methods are used in a fluent style as shown here:

 IntegerProperty n1 = new SimpleIntegerProperty(5); IntegerProperty ...

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