I'm looking for a opensource library that has an implementation of a random access map. I need a map that maintains its hash index but also indexes the values in insertion order like LinkedHashmap except you don't have to iterate through it to find eg. element 2. Something like this:
Map m = new ArrayMap();
m.put("0", "v0");
m.put("1", "v1");
m.put("2", "v2");
m.put("3", "v3");
then:
assertEquals("v2", m.get("2"));
assertEquals("v2", m.getAtIndex(2));
The idea is that both types of lookups must be fast.
A quick google didn't find anything, I didn't see it in Guava or commons collections (I may have overlooked it). I don't really have the time to implement it properly right now.