Hi,
I'm looking for a Map implementation that iterates over the key-value pairs in the order in which they were added. For example
Map orderedMap = // instantiation omitted for obvious reasons :)
orderMap.put(4, "d");
orderMap.put(10, "y");
orderMap.put(2, "b");
for (Map.Entry entry : orderedMap.entrySet()) {
System.out.println(entry.getKey() + ", " + entry.getValue());
}
Will always print
4, d
10, y
2, b
I'm using Java 5.0.
Thanks, Don