mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 17:07:05 +07:00
fix errors
This commit is contained in:
committed by
Roman Ivanov
parent
35eb29010f
commit
0752af3706
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with collect" "true"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Main {
|
||||
private Map<Integer, List<String>> test(String... list) {
|
||||
Map<Integer, List<String>> map = new HashMap<>();
|
||||
map = Arrays.stream(list).filter(Objects::nonNull).collect(Collectors.groupingBy(String::length, Collectors.toCollection(ArrayList::new)));
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new Main().test("a", "bbb", null, "cc", "dd", "eedasfasdfs", "dd"));
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// "Replace with collect" "true"
|
||||
import java.util.*;
|
||||
|
||||
public class Main {
|
||||
private Map<Integer, List<String>> test(String... list) {
|
||||
Map<Integer, List<String>> map = new HashMap<>();
|
||||
for(String s : li<caret>st) {
|
||||
if(s != null) {
|
||||
List<String> tmp = map.get(s.length());
|
||||
if(tmp == null) {
|
||||
tmp = new ArrayList<>();
|
||||
map.put(s.length(), tmp);
|
||||
}
|
||||
tmp.add(s);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new Main().test("a", "bbb", null, "cc", "dd", "eedasfasdfs", "dd"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user