Functional programming and Java
In the previous chapter, we learned about and demonstrated the key principles (APIE) of Object-Oriented Programming (OOP). In recent decades, the Java platform has evolved with the demands of the business and development community. The platform has responded to this challenge by implementing an API that uses the composition of tree functions to provide the desired result. This is in contrast to the traditional loop approach with a collection of imperative commands. This approach caused the larger code base to meet the desired goal.
From Java SE 8 onward, the platform provides an API for streaming (Reference 15). It is in the java.util.stream
package and has nothing to do with Java data streams represented by input and errors (System.out
, System.in
, and System.err
). The Stream API introduces the ability to apply operations to a sequence of elements. There are two types of intermediate operations that can edit or check data, as well as terminal operations...