VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-set-dropwhile-method-with-example/

⇱ Scala Set dropWhile() method with example - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala Set dropWhile() method with example

Last Updated : 15 Oct, 2019
The dropWhile() method is utilized to drop the longest prefix of elements from the set that satisfies the stated condition.
Method Definition: def dropWhile(p: (A) => Boolean): Set[A] Return Type: It returns a set containing all the elements after dropping the longest prefix of elements from the set that satisfies the stated condition.
Example #1:
Output:
Set(5, 1, 2, 3, 4)
Set(2, 3, 4)
Example #2:
Output:
Set(5, 1, 2, 3, 4)
Set()
Comment

Explore