Java tutorial
import java.util.EnumSet; enum Numbers { ONE, TWO, THREE, FOUR, FIVE }; public class Main { public static void main(String[] args) { // create a set EnumSet<Numbers> set; // add one element set = EnumSet.range(Numbers.TWO, Numbers.FIVE); System.out.println(set); } }