mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
new inference: ignore return dependencies of a variable when proper bound is present (IDEA-119535)
This commit is contained in:
+30
@@ -1,3 +1,4 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
@@ -5,6 +6,8 @@ import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
|
||||
import static java.util.stream.Collectors.*;
|
||||
|
||||
class Stuff {
|
||||
public enum Type { A }
|
||||
private final int value;
|
||||
@@ -41,4 +44,31 @@ class FakeErrors {
|
||||
Collector<? super T, A, D> downstream) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
class FakeErrorsComplete {
|
||||
public static List<Stuff> elems(){
|
||||
return Arrays.asList(
|
||||
new Stuff(800, Stuff.Type.A));
|
||||
}
|
||||
|
||||
public static void main(String ... args){
|
||||
|
||||
Map<Stuff.Type, Optional<Stuff>> bar =
|
||||
elems()
|
||||
.stream()
|
||||
.collect(groupingBy(Stuff::getType,
|
||||
reducing((d1, d2) -> d1.getValue() > d2.getValue() ? d1 : d2)));
|
||||
|
||||
System.out.println(bar);
|
||||
|
||||
Map<Stuff.Type, Stuff> baz =
|
||||
elems()
|
||||
.stream()
|
||||
.collect(groupingBy(Stuff::getType,
|
||||
collectingAndThen(reducing((Stuff d1, Stuff d2) -> d1.getValue() > d2.getValue() ? d1 : d2),
|
||||
Optional::get)));
|
||||
|
||||
System.out.println(baz);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user