This is a very basic question, I\'m just not that good with Java. I have a Map and I want to get a list or something of the keys in sorted order so I can iterate over them.
You have several options. Listed in order of preference:
SortedMap myNewMap = new TreeMap(myOldMap);
SortedSet keys = new TreeSet(myMap.keySet());
List keys = new ArrayList(myMap.keySet());
Collections.sort(keys);
The last two will get you what you want, but should only be used if you only want to iterate once and then forget the whole thing.