In Java, Is there an object that acts like a Map for storing and accessing key/value pairs, but can return an ordered list of keys and an ordered list of values, such that the key and value lists are in the same order?
So as explanation-by-code, I'm looking for something that behaves like my fictitious OrderedMap:
OrderedMap om = new OrderedMap();
om.put(0, "Zero");
om.put(7, "Seven");
Object o = om.get(7); // o is "Seven"
List keys = om.getKeys();
List values = om.getValues();
for(int i = 0; i < keys.size(); i++)
{
Object key = keys.get(i);
Object value = values.get(i);
Assert(om.get(key) == value);
}