public enum DaysOfWeek { SUN, MON, TUE, WED, THU, FRI, SAT } EnumSetweekdays = EnumSet.of(DaysOfWeek.MON, DaysOfWeek.TUE, DaysOfWeek.WED, DaysOfWeek.THU, DaysOfWeek.FRI);
public enum Suit { HEARTS, CLUBS, DIAMONDS, SPADES } EnumSetPackage library: java.utilredSuits = EnumSet.of(Suit.HEARTS, Suit.DIAMONDS); Suit card = ...; switch (card) { case HEARTS: case DIAMONDS: // card is red break; case CLUBS: case SPADES: // card is black break; }