So I'm currently making my own version of Pokemon replicated in Java. I've only gotten familiar with more advanced data structures very recently and I'm still not sure when one should be more appropriate than the other.
Basically, I want to store a Pokedex ( the database of Pokemon ) and HashMap seems like it would make the best fit. The key would be a Pokemon's pokedex # , and the value would be the Pokemon object in question. Due to the nature of the pokedex though, that means each Pokemon's pokedex # would just be their respective index in the pokedex.
My question is does it make sense to use a HashMap when the keys are just index values, or would it make more sense to store the Pokedex as an ArrayList ( or array even ) where each Pokemon is stored at its respective index?
Obviously if I haven't created definitions for every Pokemon yet, then the ArrayList will be memory inefficient since we will have to reserve space for every pokemon, but as far as I understand keys in hashmaps are supposed to be used to create hash values rather than being direct indices right? Or would it be appropriate regardless?
HashMap, else use anArrayList.