Returns a new, mutable EnumSet instance containing the given elements in their natural order. This method behaves identically to EnumSet#copyOf(Collection), but also accepts non-Collection iterables and empty iterables.
(
Iterable<E> iterable, Class<E> elementType)
| 142 | * accepts non-{@code Collection} iterables and empty iterables. |
| 143 | */ |
| 144 | public static <E extends Enum<E>> EnumSet<E> newEnumSet( |
| 145 | Iterable<E> iterable, Class<E> elementType) { |
| 146 | EnumSet<E> set = EnumSet.noneOf(elementType); |
| 147 | Iterables.addAll(set, iterable); |
| 148 | return set; |
| 149 | } |
| 150 | |
| 151 | // HashSet |
| 152 |