SCJP Certification

Sun Certified Java Programmer Certification exam essentials

October 24th, 2009

What is the java.util.EnumSet set?

Uncategorized, by Daisy Williams.

The java.util.EnumSet set is a special purpose set. It is used to provide an implementation for better performance for enum types. It is necessray that the elements in an enum set must come from a single enum type that is specified, explicitly or implicitly, when the set is created. They are represented internally as bit vectors. This representation is extremely compact and efficient.

The space and time performance of this class should be good enough to allow its use as a high-quality, type safe alternative to traditional int-based “bit flags.” Bulk operations should run very quickly if the specified collection is also an enum set. It is not synchronized and if multiple threads access an enum set concurrently, and at least one of the threads modifies the set, it should be synchronized externally. It is typically accomplished by synchronizing on some object that naturally encapsulates the enum set.

Share

Back Top

Responses to “What is the java.util.EnumSet set?”

Comments (0) Trackbacks (1) Leave a comment Trackback url
  1. No comments yet.
  1. What will be the result while compiing and running the code? | SCJP Certification (,November 16, 2009)

    [...] It will compile but will throw a NullPointerException at runtime. EnumSet [...]

Leave a Reply

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

*