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)
| 496 | |
| 497 | |
| 498 | public static <E extends Enum<E>> EnumSet<E> complementOf(Collection<E> collection) { |
| 499 | if (collection instanceof EnumSet) { |
| 500 | return EnumSet.complementOf((EnumSet<E>) collection); |
| 501 | } |
| 502 | checkArgument(!collection.isEmpty(), "collection is empty; use the other version of this method"); |
| 503 | Class<E> type = collection.iterator().next().getDeclaringClass(); |
| 504 | return makeComplementByHand(collection, type); |
| 505 | } |
| 506 | |
| 507 | /** |
| 508 | * Creates an {@code EnumSet} consisting of all enum values that are not in |
nothing calls this directly
no test coverage detected