Hi Team, Im reading collections and there is a topic called Backed Collections. I could not understand the output below . Please throw some light on it. TreeMap<String,String> map = new TreeMap<String,String>(); map.put("a","ant"); map.put("d","dog"); map.put("h","horse"); SortedMap<String,String> submap; submap = map.subMap("b","g"); System.out.println(map + " " + submap); map.put("b", "bat"); submap.put("f","fish"); map.put("r", "raccoon"); // submap.put("p" , "pig"); // out of range System.out.println(map + " " + submap); ** OUTPUT ** {a=ant, d=dog, h=horse} {d=dog} {a=ant, b=bat, d=dog, f=fish, h=horse, r= racoon} { b=bat, d=dog, f=fish} Please explain the output and one comment inside the code which says "out of Range".

Member Avatar
Member Avatar
+0 forum 4

This short snippet shows you how to preprocess a text to remove punctuation marks, then do a word frequency count using Counter() from the Python module collections. Finally, two sorts are applied to display words with matching frequency in alphabetical order.

Member Avatar
+2 forum 0

The End.