Functional Programming Concepts in Java

With the rise of lambda expression and newer features, there is an increasing necessity to review some of the functional programming concepts and how are they applied in Java. Currying Currying is the process of turning a function with multiple arguments into a function with fewer arguments. For example, we can turn an addition between three numbers into a single argument function: Function<Integer, Function<Integer, Function<Integer, Integer>>> abc = a -> b -> c -> a + b + c; assert abc.apply(1).apply(2).apply(3) == 6; Which is fun, but is it really useful? Definitely! Sometimes we don’t want to repeat the same argument and cannot overload the method (to simulate default parameter): ...

March 16, 20213 min