Scala List exists() method with example Last Updated : 29 Jul, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report The exists() method is utilized to check if the given predicate satisfy the elements of the list or not. Method Definition: def exists(p: (A) => Boolean): Boolean Return Type: It returns true if the stated predicate holds true for some elements of the list else it returns false. Example #1: Scala // Scala program of exists() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating a list val m1 = List(1, 2, 3, 4, 5) // Applying exists method val result = m1.exists(y => {y % 3 == 0}) // Displays output println(result) } } Output: true Example #2: Scala // Scala program of exists() // method // Creating object object GfG { // Main method def main(args:Array[String]) { // Creating a list val m1 = List(1, 2, 3, 4, 5) // Applying exists method val result = m1.exists(y => {y % 9 == 0}) // Displays output println(result) } } Output: false Comment More infoAdvertise with us Next Article Scala ListSet isEmpty() method with Example N nidhi1352singh Follow Improve Article Tags : Scala Scala Scala-Method Scala-list Similar Reads Scala ListSet exists() method with example In Scala ListSet, exists() method is utilized to check if the given predicate satisfies the elements of the listSet or not. Method Definition: def exists(p: (A) => Boolean): Boolean Return Type: It returns true if the stated predicate holds true for some elements of the listset else it returns fa 1 min read Scala Iterator exists() method with example The exists() method belongs to the concrete value members of the class Abstract Iterator. It is defined in the class IterableOnceOps. It tests whether the used predicate holds for at least one element of the stated collection. It will not terminate for infinite sized collection. Method Definition : 1 min read Scala Map exists() method with example The exists() method is utilized to check if the given predicate satisfy the elements of the map or not. Method Definition: def exists(p: ((A, B)) => Boolean): Boolean Return Type: It returns true if the stated predicate holds true for some elements of the map else it returns false. Example #1: Sc 1 min read Scala Set exists() method with example The exists() method is utilized to test whether a predicate holds for some of the elements of the set or not. Method Definition: def exists(p: (A) => Boolean): Boolean Return Type: It returns true if the stated predicate holds true for some elements of the set else it returns false. Example #1: S 1 min read Scala ListSet isEmpty() method with Example In Scala ListSet, isEmpty() method is utilized to check if the listSet is empty or not.If it is empty it will return true, else false. Method Definition: defisEmpty: BooleanReturn Type: true if the list set contains no elements, false otherwise. Example 1: Scala // Scala program of isEmpty() // meth 1 min read Scala Int !=(x: Int) method with example The !=(x: Int) method is utilized to return true if the first int value is not equal to the specified second int value, otherwise returns false. Method Definition: (First_Int_Value).!=(Second_Int_Value) Return Type: It returns true if the first int value is not equal to the specified second int valu 1 min read Like