The Java.util.EnumSet.clone() method in Java is used to return a shallow copy of the existing or this set.
Enum_Set_2 = Enum_Set_1.clone()
Parameters: The method does not take any parameters.
Return Value: The method does not return any value.
Below programs illustrate the working of Java.util.EnumSet.clone() method:
Initial set: [Welcome, To, The, World, of, Geeks] The updated set is:[Welcome, To, The, World, of, Geeks]
Initial set: [RANGE_ROVER, MUSTANG, CAMARO, AUDI, BMW] The updated set is:[RANGE_ROVER, MUSTANG, CAMARO, AUDI, BMW]
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.