EnumSet in Java is
a special implementation of Set interface added back in Java 1.5, when
Enum was first introduced into the Java Programming language.
Surprisingly so many years after the Java 1.5 release (released
30th September 2004, codenamed Tiger), a lot of Java programmers
are still unaware of several good features that were
introduced. EnumSet is one of such example which can be really
useful and provides greater performance when compared to
other Set implementations for Enum constants. When I
discussed
EnumMap in Java on my blog I wanted to mention
EnumSet as well, but couldn't find the time.
However, reading a recent Interview question about
How EnumSet is implemented
in Java from one of
my readers triggered this post. Indeed, EnumSet is becoming popular
in Java interviews because of its high performance and specialized
use with Enum constants. In this Java tutorial, we will talk about
what EnumSet means for Java, how it's implemented in the form
of RegularEnumSet and JumboEnumSet and most importantly when to use EnumSet in
Java.
Showing posts with label EnumSet in Java. Show all posts
Showing posts with label EnumSet in Java. Show all posts
Subscribe to:
Posts (Atom)