Difference between
RegularEnumSet and
JumboEnumSet in Java was asked in a recent Java interview to one of my friend, unfortunately he hasn't explored this topic well and couldn't answer this question precisely, but he made sure to learn about
EnumSet after that. When he discussed this topic to me, I really liked it because despite of usefulness of EnumSet and it's fast implementation, not many developers knows about it, despite being mentioned in Java classic
Effective Java. This makes me to write this post, where we will mainly discuss couple of
differences between RegularEnumSet and JumboEnumSet in Java, but we will also touch base upon some of the important properties of EnumSet. For those who are completely unknown of
EnumSet and wondering what the heck is this new Set implementation, it's one of those very special implementation, which is used to store
Java Enum, Since Enum always has fixed number of instances, data-structure which is used to store Enum can be optimized depending upon number of instances and that's why we have two different implementation of EnumSet in Java. We will take a closer look on this concept in next paragraph.