The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague. Edsger Dijkstra
An EnumSet is a Set which contains enum instance of a specific enum type, in a more efficient way than other Set implementations.
|Enumset internally uses bit vector which improve the performance.|
|It improves the time and space performance.|
|It does not throw concurrent modification exception.|
|Enumset is not synchronized.|
|All basic operations execute in constant time.||All basic operations execute in constant time.|
|Faster than Hashmap.||Faster than hash set.|
|Enum maps are represented internally as arrays.||Represented internally as bit vectors.|
|Bulk operation executes in constant time.||Bulk operation executes in constant time.|
When you don't want duplicate elements, you can use EnumSet.