@@ -0,0 +1,965 @@
+package leetcode;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Map;%0Aimport java.util.stream.Collectors;%0A%0Apublic class Task692 %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(new Task692().topKFrequent(new String%5B%5D%7B%22i%22, %22love%22, %22leetcode%22, %22i%22, %22love%22, %22coding%22%7D, 2));%0A        System.out.println(new Task692().topKFrequent(new String%5B%5D%7B%22the%22, %22day%22, %22is%22, %22sunny%22, %22the%22, %22the%22, %22the%22, %22sunny%22, %22is%22, %22is%22%7D, 4));%0A    %7D%0A%0A    public List%3CString%3E topKFrequent(String%5B%5D words, int k) %7B%0A        return Arrays.stream(words)%0A                .collect(Collectors.groupingBy(w -%3E w, Collectors.counting()))%0A                .entrySet()%0A                .stream()%0A                .sorted(Map.Entry.%3CString, Long%3EcomparingByValue().reversed()%0A                        .thenComparing(Map.Entry.comparingByKey()))%0A                .limit(k)%0A                .map(Map.Entry::getKey)%0A                .collect(Collectors.toList());%0A    %7D%0A%7D%0A

Add Task692