Fix bug in EnumSet.of

This commit is contained in:
Alexey Andreev 2017-12-03 17:46:35 +03:00
parent 8256302c03
commit 7b989a4c1c

View File

@ -113,6 +113,7 @@ public abstract class TEnumSet<E extends Enum<E>> extends AbstractSet<E> impleme
@SafeVarargs @SafeVarargs
public static <E extends Enum<E>> TEnumSet<E> of(E first, E... rest) { public static <E extends Enum<E>> TEnumSet<E> of(E first, E... rest) {
TEnumSet<E> result = TEnumSet.noneOf(first.getDeclaringClass()); TEnumSet<E> result = TEnumSet.noneOf(first.getDeclaringClass());
result.fastAdd(first);
for (E e : rest) { for (E e : rest) {
result.fastAdd(e); result.fastAdd(e);
} }