mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
new inference: same parametrization check tweaked (IDEA-130519)
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
import java.util.Optional;
|
||||
|
||||
interface Work<T> {
|
||||
T execute();
|
||||
}
|
||||
|
||||
interface Result {}
|
||||
|
||||
class ResultImpl implements Result {}
|
||||
|
||||
class Provider {
|
||||
<T> T doWork(Work<T> work) {
|
||||
return work.execute();
|
||||
}
|
||||
}
|
||||
|
||||
class Main {
|
||||
public static void main(String[] args) {
|
||||
final Provider provider = new Provider();
|
||||
final Optional<Result> result = provider.doWork(() -> {
|
||||
if (args.length > 1) {
|
||||
return Optional.of(new ResultImpl());
|
||||
} else {
|
||||
return Optional.of(new ResultImpl());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user