mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 05:09:37 +07:00
12 lines
443 B
Java
12 lines
443 B
Java
// "Collapse loop with stream 'forEach()'" "true-preview"
|
|
|
|
import java.util.*;
|
|
|
|
public class Main {
|
|
private Map<Integer, Map<Integer, List<String>>> test(String... list) {
|
|
Map<Integer, Map<Integer, List<String>>> map = new HashMap<>();
|
|
Arrays.stream(list).filter(Objects::nonNull).forEach(s -> map.computeIfAbsent(s.length(), k -> new HashMap<>()).computeIfAbsent(s.length(), k -> new ArrayList<>()).add(s));
|
|
return map;
|
|
}
|
|
}
|