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)