Method composition provides a flexible way of combining two or more functions into a single function. This offers flexibility that will otherwise not be present. We illustrate how this technique can be implemented using the
Function interface. Its
andThen methods support the execution of functions before or after another function. We also demonstrated the usefulness of this technique by passing the composite functions to other methods allowing it be executed when needed.
Fluent interfaces are common in functional programming languages. We discussed the difference between this type of interface and the chaining and cascading techniques. While similar, chaining methods do not necessarily return the same object each time. Cascading ...