blob: 115b70140c0fe4380a36945ab11df0adabbaf746 (
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
25
26
27
28
29
30
31
32
33
34
35
36
|
class MethodReference {
public MethodReference() {
}
public <T> MethodReference(T in) {
}
public void simpleInstanceReference() {
Runnable r = this::foo;
}
public void simpleConstructorReference() {
Runnable r = MethodReference::new;
}
public void simpleStaticReference() {
Runnable r = MethodReference::staticFoo;
}
public void generifiedStaticReference() {
StringConverter sc = MethodReference::<String>generifiedStaticFoo;
}
public void generifiedConstructorReference() {
FooConverter<MethodReference> fc = MethodReference::<String>new;
}
public void foo() {
}
private static void staticFoo() {
}
public static <T> T generifiedStaticFoo(T foo) {
return foo;
}
@FunctionalInterface
public interface StringConverter {
String hello(String x);
}
@FunctionalInterface
public interface FooConverter<K> {
K hello(String x);
}
}
|