Eugene Eugene - 13 days ago 9
Java Question

Is it possible to get element from HashMap by its position?

How to retrieve an element from HashMap by its position, is it possible at all?

Answer

HashMaps do not preserve ordering:

This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.

Take a look at LinkedHashMap, which guarantees a predictable iteration order.