How to retrieve an element from HashMap by its position, is it possible at all?
See Question&Answers more detail:osHow to retrieve an element from HashMap by its position, is it possible at all?
See Question&Answers more detail:osUse a LinkedHashMap and when you need to retrieve by position, convert the values into an ArrayList.
LinkedHashMap<String,String> linkedHashMap = new LinkedHashMap<String,String>();
/* Populate */
linkedHashMap.put("key0","value0");
linkedHashMap.put("key1","value1");
linkedHashMap.put("key2","value2");
/* Get by position */
int pos = 1;
String value = (new ArrayList<String>(linkedHashMap.values())).get(pos);