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)
| 145 | |
| 146 | |
| 147 | public static <E extends Enum<E>> EnumSet<E> newEnumSet(Iterable<E> iterable, Class<E> elementType) { |
| 148 | EnumSet<E> set = EnumSet.noneOf(elementType); |
| 149 | Iterables.addAll(set, iterable); |
| 150 | return set; |
| 151 | } |
| 152 | |
| 153 | // HashSet |
| 154 |