Scala ListSet isEmpty() method with Example
Last Updated :
13 Feb, 2023
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
import scala.collection.immutable. _
object GfG
{
def main(args : Array[String])
{
val m 1 = ListSet( 1 , 2 , 3 , 4 , 5 , 7 )
val result = m 1 .isEmpty
println(result)
}
}
|
Example 2:
Scala
import scala.collection.immutable. _
object GfG
{
def main(args : Array[String])
{
val m 1 = ListSet()
val result = m 1 .isEmpty
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...