VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-mutable-sortedset-dropwhile/

⇱ Scala Mutable SortedSet dropWhile() - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala Mutable SortedSet dropWhile()

Last Updated : 26 Mar, 2020
In Scala mutable collections, dropWhile() method is utilized to drop the longest prefix of elements from the SortedSet that satisfies the stated condition.
Method Definition: def dropWhile(p: (A) => Boolean): SortedSet[A] Return Type: It returns a TreeSet containing all the elements after dropping the longest prefix of elements from the SortedSet that satisfies the stated condition.
Example #1:
Output:
TreeSet(1, 2, 3, 4, 5)
TreeSet(2, 3, 4, 5)
Example #2:
Output:
TreeSet(15, 17, 21)
TreeSet(17, 21)
Comment

Explore