Creates an EnumSet consisting of all enum values that are not in the specified collection. If the collection is an EnumSet, this method has the same behavior as EnumSet#complementOf. Otherwise, the specified collection must contain at least one element, in order to determine
(Collection<E> collection)
| 462 | * {@code EnumSet} instance and contains no elements |
| 463 | */ |
| 464 | public static <E extends Enum<E>> EnumSet<E> complementOf(Collection<E> collection) { |
| 465 | if (collection instanceof EnumSet) { |
| 466 | return EnumSet.complementOf((EnumSet<E>) collection); |
| 467 | } |
| 468 | checkArgument( |
| 469 | !collection.isEmpty(), "collection is empty; use the other version of this method"); |
| 470 | Class<E> type = collection.iterator().next().getDeclaringClass(); |
| 471 | return makeComplementByHand(collection, type); |
| 472 | } |
| 473 | |
| 474 | /** |
| 475 | * Creates an {@code EnumSet} consisting of all enum values that are not in |
nothing calls this directly
no test coverage detected