mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 10:18:46 +00:00
36 lines
865 B
Java
36 lines
865 B
Java
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);
|
|
}
|
|
} |