in Effective Java (don't rememember item number) i read that
a enum set can be used to group together "flags" that are to be set somewhere, example:
Expand|Select|Wrap|Line Numbers
- public class Text{
- public enum Style{ BOLD, ITALIC, ... }
- public void applyStyles(Set<Style> styles) { ... }
- }
- ... and we apply the styles in user code as: ...
- text.applyStyles(EnumSet.of(Style.BOLD));
can i use a similar trick if the enumerations cannot be arbitraly mixed? Here we can pass any combination of the Style enum values... However if i have a enum A{ a1, a2, b1, b2 }
and the combinations (a1,a2) and (b1,b2) are not valid what can i use?
Thanks