logo 600x144


Functional Java is an open source library facilitating functional programming in Java. The library implements numerous basic and advanced programming abstractions that assist composition oriented development. Functional Java also serves as a platform for learning functional programming concepts by introducing these concepts using a familiar language.

The library is intended for use in production applications and is thoroughly tested using the technique of automated specification-based testing with ScalaCheck and Functional Java’s Quickcheck module. Functional Java is compiled with Java 8 targeting Java 6 bytecode. The use of lambdas within the project are backported with the Retro Lambda library, supporting Java versions 5 to 8 and beyond.


Functional Java provides abstractions for the following types:

  • Basic Data Structures - total and partial functions, products, unit, option, unbiased and right biased unions (either and validation), void.

  • Immutable Collections - array, list, vector, stream, set, map, finger tree, priority queue, heterogenous list, difference lists.

  • Other Abstractions - monoid, semigroup, natural, random number generator, reader, writer, state, input/output, parser, zipper, specification based testing, actors, concurrency, optics (lens, prism, fold, traversal and others) and type conversion.

See the features page for a brief description of each of these types.


Read the quick start guide for how to add FunctionalJava to your project and get started with a full example.

Functional Java includes numerous usage examples, this example maps a function over an array, adding 42 to each element (imports omitted).

final Array<Integer> a = array(1, 2, 3);
final Array<Integer> b = a.map(i -> i + 42);
arrayShow(intShow).println(b); // {43,44,45}

// combine into a single step
arrayShow(intShow).println(array(1, 2, 3).map(i -> i + 42));