VOOZH about

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

⇱ Scala immutable TreeSet drop() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala immutable TreeSet drop() method

Last Updated : 19 Apr, 2020
In Scala immutable TreeSet class, the drop() method is utilized to drop the first ā€˜n’ elements of the TreeSet.
Method Definition: def drop(n: Int): TreeSet[A] Return Type: It returns a new TreeSet with all the elements except the first ā€˜n’ ones.
Example #1:
Output:
TreeSet(2, 4, 6, 7, 8, 9)
TreeSet after using drop(2) method: TreeSet(6, 7, 8, 9)
Example #2:
Output:
TreeSet(2, 4, 6, 7, 8, 9)
TreeSet after using drop(3) method: TreeSet(7, 8, 9)
Comment
Article Tags:

Explore