Is there a good library for functional programming in Java?
I'm looking for stuff like Predicate and List.Find() (as a static method). Not complicated to implement, but it would be nice to find a reusable library here.
Java 8 introduced Java developers to functional programming with lambda expressions. This Java release effectively notified developers that it's no longer sufficient to think about Java programming only from the imperative, object-oriented perspective.
Functional programming is a paradigm that allows programming using expressions i.e. declaring functions, passing functions as arguments and using functions as statements (rightly called expressions in Java8).
Java is an object-oriented language. It refers to creating classes and objects to perform tasks. Hence, it is not functional programming.
The Functional Java Library The Functional Java library is an open source library meant to facilitate functional programming in Java. The library provides lots of basic and advanced programming abstractions commonly used in Functional Programming. Much of the library's functionality revolves around the F interface.
FunctionalJava is the best known library; it makes use of Java closures (BGGA) for examples:
final Array<Integer> a = array(1, 2, 3); final Array<Integer> b = a.map({int i => i + 42}); arrayShow(intShow).println(b); // {43,44,45}
EDIT
Check also lambdaj.
Further EDIT
BGGA is entirely optional. It just makes for nicer syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With