blob: b9f8c719c5b81fb3db9a7262bc8d9e76ad11bbf2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// version 8:
public class Lambda {
Runnable r = () -> System.out.println();
java.util.Comparator<Integer> c1 = (a, b) -> a - b;
java.util.Comparator<Integer> c2 = (Integer a, Integer b) -> {
return a - b;
};
java.util.function.Function<String, String> fnc = (String c) -> c;
void testLambdaInArgsList(String name, java.util.function.Function<String, String> f) {
}
void testLambdaInArgsList2(java.util.function.Function<String, String> f, String name) {
}
void test() {
testLambdaInArgsList("hello", (String c) -> c);
testLambdaInArgsList("hello", c -> c);
testLambdaInArgsList2((String c) -> c, "hello");
testLambdaInArgsList2(c -> c, "hello");
}
}
|