I'm porting some old code that uses the int enum pattern to Enum and EnumSet. It is very easy but I don't know how translate the following code to EnumSet: :
int mask = (kind == 'C' ? CLASS_MODIFIERS
: kind == 'F' ? FIELD_MODIFIERS
: kind == 'M' ? METHOD_MODIFIERS
: (CLASS_MODIFIERS | FIELD_MODIFIERS | METHOD_MODIFIERS));
int bad_flags = flags & ~mask; // <--- this
flags &= mask; // <--- and this
~mask
is simple as typing EnumSet.complementOf
but I don't see how do &.