Skip to content

Instantly share code, notes, and snippets.

@KamilaBorowska
Created November 11, 2018 21:16
Show Gist options
  • Save KamilaBorowska/1165052f72ab902c0556e1d128d11ca0 to your computer and use it in GitHub Desktop.
Save KamilaBorowska/1165052f72ab902c0556e1d128d11ca0 to your computer and use it in GitHub Desktop.
import java.util.function.Function;
public class Currying {
public static void main(String[] args) {
Function<Integer, Function<Integer, Integer>> adder = x -> y -> x + y;
Function<Integer, Integer> addToTwo = adder.apply(2);
System.out.println(addToTwo.apply(4));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment