public static <E extends Enum<E>> EnumSet<E> complementOf(Collection<E> collection) {
    if (collection instanceof EnumSet) {
      return EnumSet.complementOf((EnumSet<E>) collection);
    }
    checkArgument(
        !collection.isEmpty(), "collection is empty; use the other version of this method");
    Class<E> type = collection.iterator().next().getDeclaringClass();
    return makeComplementByHand(collection, type);
  }
public static <E extends Enum<E>> EnumSet<E> complementOf(Collection<E> collection) {
    if (collection instanceof EnumSet) {
      return EnumSet.complementOf((EnumSet<E>) collection);
    }
    checkArgument(
        !collection.isEmpty(), "collection is empty; use the other version of this method");
    Class<E> type = collection.iterator().next().getDeclaringClass();
    return makeComplementByHand(collection, type);
  }
public static < E extends Enum < E > > EnumSet < E > complementOf ( Collection < E > collection ) { if ( collection instanceof EnumSet ) { return EnumSet . complementOf ( ( EnumSet < E > ) collection ) ; } checkArgument ( ! collection . isEmpty ( ) , "collection is empty; use the other version of this method" ) ; Class < E > type = collection . iterator ( ) . next ( ) . getDeclaringClass ( ) ; return makeComplementByHand ( collection , type ) ; }
Creates an {@code EnumSet} consisting of all enum values that are not in the specified
collection. If the collection is an {@link EnumSet}, this method has the same behavior as
{@link EnumSet#complementOf}. Otherwise, the specified collection must contain at least one
element, in order to determine the element type. If the collection could be empty, use {@link
#complementOf(Collection, Class)} instead of this method.

@param collection the collection whose complement should be stored in the enum set
@return a new, modifiable {@code EnumSet} containing all values of the enum that aren't present
in the given collection
@throws IllegalArgumentException if {@code collection} is not an {@code EnumSet} instance and
contains no elements
Creates an { @code EnumSet } consisting of all enum values that are not in the specified collection . If the collection is an { @link EnumSet } this method has the same behavior as { @link EnumSet#complementOf } . Otherwise the specified collection must contain at least one element in order to determine the element type . If the collection could be empty use { @link #complementOf ( Collection Class ) } instead of this method .