mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
new inference: lambda functional type detection
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.util.Optional.of;
|
||||
|
||||
class MatchTest {
|
||||
|
||||
{
|
||||
Match<String, Integer> match = match((String s) -> s.equals("1") ? of(1) : null, s -> 1);
|
||||
}
|
||||
|
||||
private <M>Optional<M> bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T1, V1, W1> Match<T1, V1> match(Extractor<T1, W1> e, Function<W1, V1> c) {
|
||||
return null;
|
||||
}
|
||||
|
||||
class Match<T, V> {}
|
||||
|
||||
interface Extractor<T, W> {
|
||||
Optional<W> unapply(T t);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user