Functional programming is based on Streams and Lambda expressions, both introduced in Java 8. Libraries such as Retrolambda allow Java 8 code to run on older JVM runtimes, such as Java 5,6, or 7 (typically used for Android development).
Introducing functional programming in Java
Lambda expressions
Lambda expressions are syntax sugar for the use of the java.util.functions package interfaces. The most important ones are the following:
- BiConsumer<T,U>: An operation that consumes two input arguments and returns no result, usually used in the maps forEach method. It has support for chaining BiConsumers by using the andThen method.
- BiFunction<T,U,R>: A function that accepts two arguments and produces a result...