Here you can find the source of enumSet(T... elements)
@SuppressWarnings("unchecked") public static <T extends Enum<T>> EnumSet<T> enumSet(T... elements)
//package com.java2s; import java.util.EnumSet; public class Main { /**/*from w ww . j a v a2s . co m*/ * Terse (especially as a static import) way to create an EnumSet. */ @SuppressWarnings("unchecked") public static <T extends Enum<T>> EnumSet<T> enumSet(T... elements) { return EnumSet.<T>of(elements[0], elements); } }