VOOZH about

URL: https://www.geeksforgeeks.org/java/enumset-clone-method-in-java/

⇱ EnumSet clone() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

EnumSet clone() Method in Java

Last Updated : 2 Jul, 2018
The Java.util.EnumSet.clone() method in Java is used to return a shallow copy of the existing or this set. Syntax:
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: Program 1:
Output:
Initial set: [Welcome, To, The, World, of, Geeks]
The updated set is:[Welcome, To, The, World, of, Geeks]
Program 2:
Output:
Initial set: [RANGE_ROVER, MUSTANG, CAMARO, AUDI, BMW]
The updated set is:[RANGE_ROVER, MUSTANG, CAMARO, AUDI, BMW]
Comment
Article Tags: