Created
November 11, 2018 21:16
-
-
Save KamilaBorowska/1165052f72ab902c0556e1d128d11ca0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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