I have a LinkedHashMap. I want to get the Foo at index N. Is there a better way of doing this besides iterating until I find it?:
int target = N; int index =
A simplification of @Mark's solution... You only need the values, so each time you change a value in the foos Map, also update an array.
Map foos =; Foo[] fooValues = {}; foos.put(foos.name(), foo); fooValues = foos.values().toArray(new Foo[foos.size()]); // later Foo foo = fooValues[N];