Eugene Eugene - 3 months ago 29
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?


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.