mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IDEA-180417 Generated code ("Replace with collect") is invalid follow-up
Fixed for groupingBy as well
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with collect" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class Main {
|
||||
public void test() {
|
||||
String[] values = {"a", "b", "c"};
|
||||
Map<String, List<Object>> map = IntStream.range(0, values.length).boxed().collect(Collectors.groupingBy(i -> "X" + i, Collectors.mapping(i -> values[i], Collectors.toList())));
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with collect" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
public void test() {
|
||||
String[] values = {"a", "b", "c"};
|
||||
Map<String, List<Object>> map = new HashMap<>();
|
||||
f<caret>or (int i = 0; i < values.length; i++) {
|
||||
map.computeIfAbsent("X" + i, k -> new ArrayList<>()).add(values[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user