Java TreeSet clone() methodThe clone() is a method of TreeSet class. This method is used to create a copy of an existing object. This method returns a copy of the set. Syntax:Return:It returns a shallow copy of the set. Example 1Output: TreeSet: [1, 2, 5, 8, 10] Elements in Cloned TreeSet: [1, 2, 5, 8, 10] Example 2Output: TreeSet: [1, 3, 6, 9, A, B, a, b] Elements in Cloned TreeSet: [1, 3, 6, 9, A, B, a, b] Next TopicJava-treeset-comparator-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India