📅  最后修改于: 2020-11-14 06:15:48             🧑  作者: Mango
java.util.EnumSet类是用于枚举类型的专用Set实现。以下是有关EnumSet的要点-
枚举集中的所有元素都必须来自创建该枚举集时显式或隐式指定的单个枚举类型。
枚举集在内部表示为位向量。
EnumSet不同步。如果多个线程同时访问一个枚举集,并且至少有一个线程修改了该枚举集,则应在外部进行同步。
以下是java.util.EnumSet类的声明-
public abstract class EnumSet>
extends AbstractSet
implements Cloneable, Serializable
Sr.No. | Method & Description |
---|---|
1 | static This method creates an enum set containing all of the elements in the specified element type. |
2 | EnumSet This method returns a copy of this set. |
3 | static This method creates an enum set with the same element type as the specified enum set, initially containing all the elements of this type that are not contained in the specified set. |
4 | static This method creates an enum set initialized from the specified collection. |
5 | static This method creates an enum set with the same element type as the specified enum set, initially containing the same elements (if any). |
6 | static This method creates an empty enum set with the specified element type. |
7 | static This method creates an enum set initially containing the specified element. |
8 | static This method creates an enum set initially containing the specified elements. |
9 | static This method creates an enum set initially containing the specified elements. |
10 | static This method creates an enum set initially containing the specified elements. |
11 | static This method creates an enum set initially containing the specified elements. |
12 | static This method creates an enum set initially containing the specified elements. |
13 | static This method creates an enum set initially containing all of the elements in the range defined by the two specified endpoints. |
此类从以下类继承方法-