Methods Summary |
---|
public static java.util.EnumSet | allOf(java.lang.Class elementType)Creates an enum set filled with all the enum elements of the specified
{@code elementType}.
EnumSet<E> set = noneOf(elementType);
set.complement();
return set;
|
public java.util.EnumSet | clone()Creates a new enum set with the same elements as those contained in this
enum set.
try {
Object set = super.clone();
return (EnumSet<E>) set;
} catch (CloneNotSupportedException e) {
return null;
}
|
abstract void | complement()
|
public static java.util.EnumSet | complementOf(java.util.EnumSet s)Creates an enum set. All the contained elements complement those from the
specified enum set.
EnumSet<E> set = EnumSet.noneOf(s.elementClass);
set.addAll(s);
set.complement();
return set;
|
public static java.util.EnumSet | copyOf(java.util.EnumSet s)Creates an enum set. All the contained elements are of type
Class<E>, and the contained elements are the same as those
contained in {@code s}.
EnumSet<E> set = EnumSet.noneOf(s.elementClass);
set.addAll(s);
return set;
|
public static java.util.EnumSet | copyOf(java.util.Collection c)Creates an enum set. The contained elements are the same as those
contained in collection {@code c}. If c is an enum set, invoking this
method is the same as invoking {@link #copyOf(EnumSet)}.
if (c instanceof EnumSet) {
return copyOf((EnumSet<E>) c);
}
if (0 == c.size()) {
throw new IllegalArgumentException();
}
Iterator<E> iterator = c.iterator();
E element = iterator.next();
EnumSet<E> set = EnumSet.noneOf(element.getDeclaringClass());
set.add(element);
while (iterator.hasNext()) {
set.add(iterator.next());
}
return set;
|
boolean | isValidType(java.lang.Class cls)
return cls == elementClass || cls.getSuperclass() == elementClass;
|
public static java.util.EnumSet | noneOf(java.lang.Class elementType)Creates an empty enum set. The permitted elements are of type
Class<E>.
if (!elementType.isEnum()) {
throw new ClassCastException();
}
// BEGIN android-changed
E[] enums = SpecialAccess.LANG.getEnumValuesInOrder(elementType);
if (enums.length <= 64) {
return new MiniEnumSet<E>(elementType, enums);
}
return new HugeEnumSet<E>(elementType, enums);
// END android-changed
|
public static java.util.EnumSet | of(E e1, E e2, E e3)Creates a new enum set, containing only the specified element. There are
six overloadings of the method. They accept from one to five elements
respectively. The sixth one receives an arbitrary number of elements, and
runs slower than those that only receive a fixed number of elements.
EnumSet<E> set = of(e1, e2);
set.add(e3);
return set;
|
public static java.util.EnumSet | of(E e1, E e2, E e3, E e4)Creates a new enum set, containing only the specified element. There are
six overloadings of the method. They accept from one to five elements
respectively. The sixth one receives an arbitrary number of elements, and
runs slower than those that only receive a fixed number of elements.
EnumSet<E> set = of(e1, e2, e3);
set.add(e4);
return set;
|
public static java.util.EnumSet | of(E e1, E e2, E e3, E e4, E e5)Creates a new enum set, containing only the specified element. There are
six overloadings of the method. They accept from one to five elements
respectively. The sixth one receives an arbitrary number of elements, and
runs slower than those that only receive a fixed number of elements.
EnumSet<E> set = of(e1, e2, e3, e4);
set.add(e5);
return set;
|
public static java.util.EnumSet | of(E start, E others)Creates a new enum set, containing only the specified elements. It can
receive an arbitrary number of elements, and runs slower than those only
receiving a fixed number of elements.
EnumSet<E> set = of(start);
for (E e : others) {
set.add(e);
}
return set;
|
public static java.util.EnumSet | of(E e)Creates a new enum set, containing only the specified element. There are
six overloadings of the method. They accept from one to five elements
respectively. The sixth one receives an arbitrary number of elements, and
runs slower than those that only receive a fixed number of elements.
EnumSet<E> set = EnumSet.noneOf(e.getDeclaringClass());
set.add(e);
return set;
|
public static java.util.EnumSet | of(E e1, E e2)Creates a new enum set, containing only the specified element. There are
six overloadings of the method. They accept from one to five elements
respectively. The sixth one receives an arbitrary number of elements, and
runs slower than those that only receive a fixed number of elements.
EnumSet<E> set = of(e1);
set.add(e2);
return set;
|
public static java.util.EnumSet | range(E start, E end)Creates an enum set containing all the elements within the range defined
by {@code start} and {@code end} (inclusive). All the elements must be in
order.
if (start.compareTo(end) > 0) {
throw new IllegalArgumentException();
}
EnumSet<E> set = EnumSet.noneOf(start.getDeclaringClass());
set.setRange(start, end);
return set;
|
abstract void | setRange(E start, E end)
|
java.lang.Object | writeReplace()
SerializationProxy proxy = new SerializationProxy();
proxy.elements = toArray(new Enum[0]);
proxy.elementType = elementClass;
return proxy;
|