![]() |
VOOZH | about |
Enum_Set = EnumSet.of(E ele1, E ele2, E ele3, ...)Parameters: The method can take multiple parameters as many as present in the enum. Return Values: The method returns an enum set initially containing the specified elements passed through the parameter. Exceptions: The method throws NullPointerException if any element passed is NULL. Below programs illustrate the working of java.util.EnumSet.of() method: Program 1: Adding one element at a time replaces the previous element.
The enum set is: [The] The enum set is: [Geeks] The enum set is: [Welcome]
The enum set is: [The, Geeks] The enum set is: [Welcome, Geeks] The enum set is: [World, of]
The enum set is: [The, Geeks] The enum set is: [Welcome, The, Geeks] The enum set is: [Welcome, World, of, Geeks] The enum set is: [Welcome, To, The, World, of, Geeks]
public static <E extends Enum<E>> EnumSet<E> of(E_first, E_rest)Parameters: The method takes two parameters:
Set: [Welcome, The, World, Geeks]