VOOZH about

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

⇱ Scala immutable TreeSet -() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala immutable TreeSet -() method

Last Updated : 19 Apr, 2020
In Scala immutable TreeSet class, the -() method is utilized to remove an element from the given TreeSet.
Method Definition: def -(elem: A): TreeSet[A] Return Type: It returns a new TreeSet with an element removed from the given TreeSet.
Example #1:
Output:
TreeSet(a, e, i, o, u)
After removing an element: TreeSet(a, e, i, o)
Example #2:
Output:
TreeSet(1, 2, 3, 4, 5)
After removing an element: TreeSet(2, 3, 4, 5)
Comment
Article Tags:

Explore