Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Functional Programming in Java [closed]

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.

like image 999
ripper234 Avatar asked Aug 12 '09 16:08

ripper234


People also ask

Is functional programming possible in Java?

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.

What is meant by functional programming in Java?

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).

Why is Java not a functional programming language?

Java is an object-oriented language. It refers to creating classes and objects to perform tasks. Hence, it is not functional programming.

What facilitates functional programming in Java?

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.


1 Answers

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.

like image 62
dfa Avatar answered Sep 20 '22 04:09

dfa