I\'m trying to weigh the pros and cons of using an EnumMap
over a HashMap
. Since, I will always be looking up using a String
, it seems tha
If all valid keys can be enumerated, I would use that as it ensures you are always working with a valid value.
It can also avoid confusion as String can be used for lots of things and is easy to turn an "Animal" string into a string used for something else. As enum types are not interchangable with other types in general (unless you use a common interface), there is less chance of error in coding.