mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
15 lines
453 B
Java
15 lines
453 B
Java
// "Collapse loop with stream 'collect()'" "true-preview"
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Main {
|
|
Map<Integer, List<String>> test(List<String> list) {
|
|
Map<Integer, List<String>> map = list.stream().collect(Collectors.groupingBy(String::length));
|
|
return map;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(new Main().test("a", "bbb", null, "cc", "dd", "eedasfasdfs", "dd"));
|
|
}
|
|
}
|