Commit 237ce5c0 authored by Sanjna's avatar Sanjna

Modified q7

parent 44a8c4b9
......@@ -40,7 +40,7 @@ public class q7 {
dataMap.put(str, Collections.frequency(dataArray, str));
}
dataMap.entrySet().stream().sorted(Map.Entry.<String, Integer>comparingByValue().thenComparing(Map.Entry::getKey, String.CASE_INSENSITIVE_ORDER)).forEach(x -> System.out.println(x.getKey()+","+x.getValue()));
dataMap.entrySet().stream().sorted(Map.Entry.<String, Integer>comparingByValue().reversed().thenComparing(Map.Entry::getKey)).forEach(x -> System.out.println(x.getKey()+","+x.getValue()));
myReader.close();
}
catch (FileNotFoundException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment