I'm working on a large team of programmers on a Java System. The library LamdbaJ is in the working library, but many of the developers are skeptical of the benefits of functional programming.
(My background is that I'm a big fan of Clojure).
I want to articulate the benefits of higher order functions over Java idioms.
The two that come to mind are:
- function composition (can plug them together)
- functions as values (you can replace a function with value and it will work the same)
But when I compare the map
operation to simply walking a list with the for (x : y)
in Java - function composition and functions as values don't seem to make a huge difference to the verbosity or robustness of the code.
I want to articulate some reasons (in this environment) why a functional approach is similar.
My question is: In Java, what are the reasons for Higher Order Functions (via lambdaj) over for (x:y) loops?
Assumptions:
- Running Java 7 due to Websphere limitations.