VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-immutable-treeset-clone-method/

⇱ Scala immutable TreeSet clone() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala immutable TreeSet clone() method

Last Updated : 19 Apr, 2020
In Scala immutable TreeSet class, the clone() method is used to create a copy of the given TreeSet.
Method Definition: def clone(): Queue[A] Return Type: It return a new TreeSet which is a copy of the given TreeSet.
Example #1:
Output:
TreeSet(1, 2, 3, 4, 5)
Clone of the TreeSet: TreeSet(1, 2, 3, 4, 5)
Example #2:
Output:
TreeSet(a, e, i, o, u)
Clone of the TreeSet: TreeSet(a, e, i, o, u)
Comment
Article Tags:

Explore