public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E> implements Cloneable, Serializable
| Modifier and Type | Method and Description |
|---|---|
static <E extends Enum<E>> |
allOf(Class<E> elementType)
Creates an enum set filled with all the enum elements of the specified
elementType. |
EnumSet<E> |
clone()
Creates a new enum set with the same elements as those contained in this
enum set.
|
static <E extends Enum<E>> |
complementOf(EnumSet<E> s)
Creates an enum set.
|
static <E extends Enum<E>> |
copyOf(Collection<E> c)
Creates an enum set.
|
static <E extends Enum<E>> |
copyOf(EnumSet<E> s)
Creates an enum set.
|
static <E extends Enum<E>> |
noneOf(Class<E> elementType)
Creates an empty enum set.
|
static <E extends Enum<E>> |
of(E e)
Creates a new enum set, containing only the specified element.
|
static <E extends Enum<E>> |
of(E start,
E... others)
Creates a new enum set, containing only the specified elements.
|
static <E extends Enum<E>> |
of(E e1,
E e2)
Creates a new enum set, containing only the specified elements.
|
static <E extends Enum<E>> |
of(E e1,
E e2,
E e3)
Creates a new enum set, containing only the specified elements.
|
static <E extends Enum<E>> |
of(E e1,
E e2,
E e3,
E e4)
Creates a new enum set, containing only the specified elements.
|
static <E extends Enum<E>> |
of(E e1,
E e2,
E e3,
E e4,
E e5)
Creates a new enum set, containing only the specified elements.
|
static <E extends Enum<E>> |
range(E start,
E end)
Creates an enum set containing all the elements within the range defined
by
start and end (inclusive). |
equals, hashCode, removeAlladd, addAll, clear, contains, containsAll, isEmpty, iterator, remove, retainAll, size, toArray, toArray, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitadd, addAll, clear, contains, containsAll, copyOf, isEmpty, iterator, of, of, of, of, of, of, remove, retainAll, size, spliterator, toArray, toArrayforEach, parallelStream, removeIf, stream, toArraypublic static <E extends Enum<E>> EnumSet<E> noneOf(Class<E> elementType)
elementType - the class object for the elements contained.elementType.ClassCastException - if the specified element type is not and enum type.public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType)
elementType.elementType - the class object for the elements contained.ClassCastException - if the specified element type is not and enum type.public static <E extends Enum<E>> EnumSet<E> copyOf(EnumSet<E> s)
s.s - the enum set from which to copy.ClassCastException - if the specified element type is not and enum type.public static <E extends Enum<E>> EnumSet<E> copyOf(Collection<E> c)
c. If c is an enum set, invoking this
method is the same as invoking copyOf(EnumSet).c - the collection from which to copy. if it is not an enum set,
it must not be empty.IllegalArgumentException - if c is not an enum set and contains no elements at all.NullPointerException - if c is null.public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s)
s - the specified enum set.NullPointerException - if s is null.public static <E extends Enum<E>> EnumSet<E> of(E e)
public static <E extends Enum<E>> EnumSet<E> of(E e1, E e2)
of in interface Set<E extends Enum<E>>E - the Set's element typee1 - the initially contained element.e2 - another initially contained element.NullPointerException - if any of the specified elements is null.public static <E extends Enum<E>> EnumSet<E> of(E e1, E e2, E e3)
of in interface Set<E extends Enum<E>>E - the Set's element typee1 - the initially contained element.e2 - another initially contained element.e3 - another initially contained element.NullPointerException - if any of the specified elements is null.public static <E extends Enum<E>> EnumSet<E> of(E e1, E e2, E e3, E e4)
of in interface Set<E extends Enum<E>>E - the Set's element typee1 - the initially contained element.e2 - another initially contained element.e3 - another initially contained element.e4 - another initially contained element.NullPointerException - if any of the specified elements is null.public static <E extends Enum<E>> EnumSet<E> of(E e1, E e2, E e3, E e4, E e5)
of in interface Set<E extends Enum<E>>E - the Set's element typee1 - the initially contained element.e2 - another initially contained element.e3 - another initially contained element.e4 - another initially contained element.e5 - another initially contained element.NullPointerException - if any of the specified elements is null.@SafeVarargs public static <E extends Enum<E>> EnumSet<E> of(E start, E... others)
of in interface Set<E extends Enum<E>>E - the Set's element typestart - the first initially contained element.others - the other initially contained elements.NullPointerException - if any of the specified elements is null.public static <E extends Enum<E>> EnumSet<E> range(E start, E end)
start and end (inclusive). All the elements must be in
order.start - the element used to define the beginning of the range.end - the element used to define the end of the range.NullPointerException - if any one of start or end is null.IllegalArgumentException - if start is behind end.