Scala SortedMap isEmpty() method with example
The isEmpty() method is utilized to check if the given SortedMap is empty or not.
Method Definition: def isEmpty: Boolean
Return Type: It returns true if the stated SortedMap is empty else returns false.
Example #1:
import scala.collection.immutable.SortedMap
object GfG
{
def main(args : Array[String])
{
val m 1 = SortedMap( 3 - > "geeks" , 1 - > "for" , 2 - > "cs" , 3 - > "geeks" )
val result = m 1 .isEmpty
println(result)
}
}
|
Example #2:
import scala.collection.immutable.SortedMap
object GfG
{
def main(args : Array[String])
{
val m 1 = SortedMap( 2 - > 4 )
val result = m 1 .isEmpty
println(result)
}
}
|
Last Updated :
03 Nov, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...