mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 18:58:31 +07:00
16 lines
536 B
Java
16 lines
536 B
Java
// "Replace Stream API chain with loop" "true"
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class Main {
|
|
private static TreeMap<Integer, LinkedHashSet<String>> getMap(List<String> strings) {
|
|
return strings.stream().coll<caret>ect(
|
|
Collectors.groupingBy(String::length, () -> new TreeMap<>(Comparator.reverseOrder()), Collectors.toCollection(LinkedHashSet::new)));
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(getMap(Arrays.asList("a", "bbb", "cccc", "dddd", "ee", "e")));
|
|
}
|
|
}
|