Here you can find the source of createEnumSet(Class
public static <E extends Enum<E>> EnumSet<E> createEnumSet(Class<E> elementType)
//package com.java2s; import java.util.Collection; import java.util.EnumSet; public class Main { public static <E extends Enum<E>> EnumSet<E> createEnumSet(Collection<E> c) { if (c == null) { return null; }//from w w w. j a v a2s. c o m return EnumSet.copyOf(c); } public static <E extends Enum<E>> EnumSet<E> createEnumSet(Class<E> elementType) { if (elementType == null) { return null; } return EnumSet.allOf(elementType); } }