Skip to content
This repository

Are you Funky?

There is no such thing as functional programming in Java, but sometimes we emulate it using anonymous classes.

FunkyJFunctional (aka FJF) provides a new way to do functional programming in Java, using some Java syntactic sugar: method local class declarations and init blocks.

FJF integrates with many different frameworks. If not already available, feel free to implement a new funky module for the framework you love!

A few examples with different frameworks:

public void sayHelloInExecutor(ExecutorService executor) {
    class Hello {{ System.out.println("Hello Funky World"); }}
  • Guava, with a funky Predicate (Guava is the former google collections)
public Iterable<User> filterMinors(Iterable<User> users) {
    class Minor extends Pred<User> {{ out = in.getAge() < 18; }}
    return filter(users, withPred(Minor.class));
public static List<Integer> factors(final int number) {
    class Factor extends FF<Integer, Boolean> {{ out = number % in == 0; }}
    return range(1, number + 1).filter(withF(Factor.class, number));
public void getMajorUsers_returns_no_minor_User() {
    List<User> majorUsers = userService.getMajorUsers();
    class Minor extends Cond<User> {{ out = in.getAge() < 18; }}
class FortyTwo extends AROM<String> {{ out = "42"; }}
AbstractReadOnlyModel<String> readOnlyModel = withAROM(FortyTwo.class);
class BtonClick extends ActL {{ doSomething(e); }}

Sounds funky? We think it is ;-).



Javadoc Google Group

Looking for the documentation? Have a look at the Funky javadoc!

Any question? Please ask them on the dedicated Google Group.

Continuous Integration

FJF has continuous integration thanks to CloudBees DEV@Cloud free plan for FOSS projects.

Built on CloudBees

Build time trend & Test Result Trend

Build Trend Test result trend

Something went wrong with that request. Please try again.