VOOZH about

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

⇱ ConcurrentSkipListSet clone() method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ConcurrentSkipListSet clone() method in Java

Last Updated : 17 Sep, 2018
The clone() method of java.util.concurrent.ConcurrentSkipListSet is an in-built function in Java which returns a shallow copy of this ConcurrentSkipListSet instance. Syntax:
ConcurrentSkipListSet.clone()
Parameters: The function does not accept any parameter. Return Value: The function returns a shallow copy of ConcurrentSkipListSet. Below programs illustrate the ConcurrentSkipListSet.clone() method: Program 1:
Output:
The set contains: [10, 11, 12, 13, 14, 15]
The clone set contains: [10, 11, 12, 13, 14, 15, 16]
Program 2:
Output:
The set contains: [Gfg, fun, is]
The clone set contains: [Gfg, fun, is, site]
Reference: https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentSkipListSet.html#clone()
Comment