`EnumMap` is optimized Map implementation exclusively for Enum keys.
Iterator over the key set takes time proportional to the number of constants in the enumerated type and returns the keys in their natural order (the order in which enums are declared).
If you are thinking of a high performance Map, EnumMap
could be a decent choice for enumeration data.
All keys used in EnumMap
must be from same Enum
type which is specified while creating EnumMap
.
Iterators are fail-fast.
You cannot insert null keys inside EnumMap
.