EnumMap vs HashMap

Both implement Map interface.
1. EnumMap is optimized for enums to store in a map. EnumMap internally uses array and provide constant time performance for common methods like get() and put().
2. You can only use Enum as a key in EnumMap whereas in HashMap you can use any object including Enum
3. As EnumMap is optimized for enum keys , so it’s performance is better than HashMap when use Enum key as object
4. One more difference is that Enummap dont use hascode() method to store the keys and values so there is no collision.