MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

functional/CurryingAndPartials.java:12–28  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

10 return a + b;
11 }
12 public static void main(String[] args) {
13 // Curried function:
14 Function<String, Function<String, String>> sum =
15 a -> b -> a + b; // [1]
16
17 System.out.println(uncurried("Hi ", "Ho"));
18
19 Function<String, String>
20 hi = sum.apply("Hi "); // [2]
21 System.out.println(hi.apply("Ho"));
22
23 // Partial application:
24 Function<String, String> sumHi =
25 sum.apply("Hup ");
26 System.out.println(sumHi.apply("Ho"));
27 System.out.println(sumHi.apply("Hey"));
28 }
29}
30/* Output:
31Hi Ho

Callers

nothing calls this directly

Calls 2

uncurriedMethod · 0.95
applyMethod · 0.65

Tested by

no test coverage detected