VOOZH about

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

⇱ Scala immutable TreeSet contains() method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala immutable TreeSet contains() method

Last Updated : 19 Apr, 2020
In Scala immutable TreeSet class, the contains() method is utilized to check if an element is present in the TreeSet of not.
Method Definition: def contains(elem: A): Boolean Return Type: It returns true if the element is present in the TreeSet or else it returns false.
Example #1:
Output:
TreeSet(1, 12, 23, 41, 43, 72)
TreeSet contains '10': false
Example #2:
Output:
TreeSet(e, g, k, s)
TreeSet contains 'k': true
Comment
Article Tags:

Explore