mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-17 20:11:25 +07:00
new inference: collect additional constraints from lambda return expressions when lambda parameters are already fixed; process constraints without input variables before others, so their 'return' expressions could influence next rounds; testdata (IDEA-144596)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
public void testIt()
|
||||
{
|
||||
Map<Integer, String> innerMap = new HashMap<>();
|
||||
innerMap.put(2, "abc");
|
||||
Map<Long, Map<Integer, String>> outerMap = new HashMap<>();
|
||||
outerMap.put(1L, innerMap);
|
||||
Map<Long, Map<Integer, String>> transformedMap = outerMap.entrySet().stream()
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
m -> m.getValue().entrySet().stream()
|
||||
.collect(Collectors.toMap(
|
||||
Map.Entry::getKey,
|
||||
v -> v.getValue().toUpperCase()))));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collector;
|
||||
|
||||
class FooBar {
|
||||
|
||||
void p(Map<String, String> m) {
|
||||
m.entrySet().stream()
|
||||
.collect(Collector.of(() -> new HashMap<>(),
|
||||
(a, e) -> a.put(e.getValue(), e.getKey()),
|
||||
(l, r) -> {
|
||||
l.put<caret>All(r);
|
||||
return l;
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user