How EnumSet is implemented in Java
Though it's pretty low level implementation detail, it's good to know about it to impress Interviewer, if you happened to ask same question in your interview.
Now let's recap some of the important properties of EnumSet in Java
1) EnumSet is not thread-safe, which means if it needs to be externally synchronized, when multiple thread access it and one of them modifies the Collection.
2) EnumSet can not be used to store any other object except Enum, at the same time you can not store instances of two different Enum.
3) EnumSet doesn't allow Null elements.
4) EnumSet Iterators are fail-safe in nature.
That's all folks about difference in RegularEnumSet and JumboEnumSet in Java. As I said, this is very useful class and has been recommended by Joshua Bloch on Effective Java book as well. Beauty of EnumSet implementation lies on how they are created. This class is purposefully made package-private so that no one can create instance of EnumSet. you can only create instance of EnumSet by using different factory methods provided by API. This allows API to choose from RegularEnumSet and JumboEnumSet, depending upon number of instances of Enum i.e. key size. This arrangement is also very extensible and manageable because you can introduce new EnumSet implementation without breaking client code.
Related articles from Java Collection Framework