Files
Tagir Valeev 8560c6a5d1 [java-inspections] More preview tests
GitOrigin-RevId: 571a82f66623887c1b5008963df842b2597c58c9
2022-07-27 10:00:31 +00:00

14 lines
447 B
Java

// "Replace with 'Entry.comparingByKey()'" "true-preview"
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
class X {
private static List<Map.Entry<String, Integer>> sortFrequencies(Map<String, Integer> freq) {
return freq.entrySet().stream()
.sorted(Map.Entry.<String, Integer>comparingByKey().thenComparing(Map.Entry::getValue))
.collect(Collectors.toList());
}
}