VOOZH about

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

⇱ Scala immutable TreeSet dropRight() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala immutable TreeSet dropRight() method

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

Explore