EnumMap are efficient, compact implementations of the Map interfaces. Keys of EnumMap must be coming from single entry.

EnumMap keep order of their collection, which is same as the order of enum constants.

It does not accept null keys.

EnumMap is not synchronized and it has to be synchronized manually before using it in a concurrent or multi-threaded environment.

It is faster than Hashmap as it has already limited keys which is predicted by enum constants.

EnumMap Example:

Reference Docs:
Oracle EnumMap Reference
It's good to share...Share on FacebookTweet about this on TwitterShare on LinkedInPin on PinterestShare on Google+Email this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *