VOOZH about

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

⇱ Scala Set find() method with example - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala Set find() method with example

Last Updated : 18 Oct, 2019
The find() method is utilized to find the first element of the set that satisfies the given predicate if present.
Method Definition: def find(p: (A) => Boolean): Option[A] Return Type: It returns the first element of the set which satisfies the given predicate.
Example #1:
Output:
Some(3)
Example #2:
Output:
None
Comment

Explore