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: Boolean
Return Type: true if the list set contains no elements, false otherwise.
Example 1:
Scala
// Scala program of isEmpty() // method import scala.collection.immutable. _ // Creating object object GfG { // Main method def main(args : Array[String]) { // Creating listset val m 1 = ListSet( 1 , 2 , 3 , 4 , 5 , 7 ) // Applying filter method val result = m 1 .isEmpty // Displays output println(result) } } |
Output:
false
Example 2:
Scala
// Scala program of count() // method import scala.collection.immutable. _ // Creating object object GfG { // Main method def main(args : Array[String]) { // Creating listset val m 1 = ListSet() // Applying filter method val result = m 1 .isEmpty // Displays output println(result) } } |
Output:
true
Contact Us