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 =
Guava library can help in this case:
public static T com.google.common.collect.Iterables.get(Iterable iterable, int position)
see javadoc: Iterables.get
For your case the code can be like this:
Iterables.get(foos.values(), N);