EnumSet
, as old as the enum
itself (both since Java 5), is supposed to be a noncompromizing replacement for the use case of bitfields: as fast and lean as the bitfield (well, except for not being a primitive type), and typesafe to boot. On the other hand, the most recent and for years the most anticipated Java API—the Streams API—unashamedly employs bitfields for Spliterator
's characteristics.
Should I consider the above as a clear admission by the core Java experts that EnumSet
is not that good after all? Should I reconsider the common best-practice advice to never use bitfields?