I thought that HashMap is unordered, and when iterating over the keys, you can\'t know what will be the order? In this example, it looks like the map is already sorted by the ke
Treemap is a sorted map which contains keys in sorted order and HashMap can't gurantee you sorted map.So,always choose Treemap when ever you want sorted keys