java.util.EnumSet<K>
A specialized Set implementation for use with enum types. All of the elements in an enum set must come from a single enum type that is specified, explicitly or implicitly, when the set is created.
Some Methods of EnumSet.
add(K): This method ensures that this collection contains the specified element.
addAll(Collection): This method adds all of the elements in the specified collection to this collection.
EnumSet.allOf(Class): This method creates an enum set containing all of the elements in the specified element type.
clear(): This method removes all of the elements from this collection
clone(): This method returns a copy of this set.
EnumSet.complementOf(EnumSet): This method creates an enum set with the same element type as the specified enumset, initially containing all the elements of this type that are not contained in the specified set.
contains(Object): This method returns true if this collection contains the specified element
EnumSet.copyOf(Collection): This method creates an enum set initialized from the specified collection.
EnumSet.copyOf(EnumSet): This method creates an enum set with the same element type as the specified enumset, initially containing the same elements
equals(Object): This method compares the specified object with this set for equality.
forEach(Consumer): This method performs the given action for each element of the Iterable until all elements have been processed or the action throws an exception.
hashCode(): This method returns the hash code value for this set.
isEmpty(): This method returns true if this collection contains no elements.
iterator(): This method returns an iterator over the elements contained in this collection.
EnumSet.noneOf(Class): This method creates an empty enum set with the specified element type.
EnumSet.of(K): This method creates an enum set initially containing the specified element.
EnumSet.of(K, K): This method creates an enum set initially containing the specified elements.
Some more Methods of EnumSet class
No comments:
Post a Comment