Skip to content

Instantly share code, notes, and snippets.

@ssledz
Created April 22, 2020 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssledz/4c919f284f8dbdb3ddd26636a1fc3ec9 to your computer and use it in GitHub Desktop.
Save ssledz/4c919f284f8dbdb3ddd26636a1fc3ec9 to your computer and use it in GitHub Desktop.
import java.util.function.Function;
public class CurryingExample {
static String f(String a, String b, int c) {
return "a=" + a + ", b=" + b + ", c=" + c;
}
public static void main(String[] args) {
Function<String, Function<String, Function<Integer, String>>> curryF = (String a) -> {
return (String b) -> {
return (Integer c) -> f(a, b, c);
};
};
System.out.println(curryF.apply("a").apply("b").apply(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment