code: public static <T extends Enum<T>> EnumSet<T> toEnumSet(Class<T> clazz, T... ts)
    {
      if(ts == null)
        return null;
  
      EnumSet<T> res = EnumSet.noneOf(clazz);
      for(T t : ts)
      {
        res.add(t);
      }
      return res;
    }
docs: Turns an array of enumeration values into an enum set
  
  @param clazz the type of the enum
  @param ts the array of enums
  @return the enum set containing all the values from the array