Here you can find the source of toEnumSet( Class
public static <E extends Enum<E>> EnumSet<E> toEnumSet( Class<E> classValue, Collection<String> stringValues)
//package com.java2s; import java.util.Collection; import java.util.EnumSet; public class Main { public static <E extends Enum<E>> EnumSet<E> toEnumSet( Class<E> classValue, Collection<String> stringValues) { EnumSet<E> result = EnumSet.noneOf(classValue); for (String s : stringValues) { result.add(Enum.valueOf(classValue, s)); }/* ww w.ja va2 s . co m*/ return result; } }