code: public static <E extends Enum<E>> StreamableEnumSet<E> copyOf (Collection<E> s)
      {
          if (s instanceof StreamableEnumSet<?>) {
              StreamableEnumSet<E> set = (StreamableEnumSet<E>)s;
              return copyOf(set);
          }
          if (s.isEmpty()) {
              throw new IllegalArgumentException("Collection must have at least one element.");
          }
          StreamableEnumSet<E> set = new StreamableEnumSet<E>(
              s.iterator().next().getDeclaringClass());
          set.addAll(s);
          return set;
      }
docs: Creates a set containing all elements in the collection provided (which must have at least
  one element, unless it is a <code>StreamableEnumSet</code>).