Module id.xfunction

Class Curry

Object
Curry

public class Curry extends Object
Set of functions for implementing currying in Java.

For example imagine you have a bifunction like:


 String m(String s, Integer i)
 
And you want to create a function from it which will be calling m with specific second argument (ex. 5).

Instead of writing:


 list.stream()
     .map(s -> m(s, 5))
     .collect(toList());
 
You can do:

 list.stream()
     .map(curry2nd(this.m, 5))
     .collect(toList());