package com.logicbig.example.enumset;
import java.time.DayOfWeek;
import java.util.EnumSet;
public class AllOfExample {
public static void main(String... args) {
EnumSet<DayOfWeek> set = EnumSet.allOf(DayOfWeek.class);
System.out.println(set);
//set is modifiable
set.remove(DayOfWeek.SUNDAY);
System.out.println("-- after modification --");
System.out.println(set);
}
}
Output
[MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY]
-- after modification --
[MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY]