LinkedHashSet clone() method in Java
The Java.util.LinkedHashSet.clone() method is used to return a shallow copy of the mentioned hash set. It just creates a copy of the set.
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.
Parameters: The method does not take any parameters.
Return Value: The method just returns a copy of the LinkedHashSet.
Below program illustrate the Java.util.LinkedHashSet.clone() method:
LinkedHashSet: [Welcome, To, Geeks, 4] The new set: [Welcome, To, Geeks, 4]