Possible Duplicate:
Bi-directional Map in Java?
How can I retrieve key of Map
by index when keys are not numeric and unordered ?
For example :
Map<String, Integer> test = new TreeMap<String, Integer>();
test.put("a", 1);
test.put("b", 2);
test.put("z", 3);
test.put("m", 4);
I want to get z
if I have index 2 or a
if I have index 0.
I know I can do dirty loop with increment to get it but is there another smart way to do it ?