How to retrieve an element from HashMap by its position, is it possible at all?
Use LinkedHashMap and use this function.
private LinkedHashMap map = new LinkedHashMap();
Define like this and.
private Entry getEntry(int id){
Iterator iterator = map.entrySet().iterator();
int n = 0;
while(iterator.hasNext()){
Entry entry = (Entry) iterator.next();
if(n == id){
return entry;
}
n ++;
}
return null;
}
The function can return the selected entry.