Scala List isEmpty Operation with example
Last Updated :
13 Aug, 2019
The isEmpty operation is utilized to check if the stated list is empty or not.
Syntax:
m1.isEmpty
Here, m1 is Map name. isEmpty is method which returns true if the stated list is empty else it returns false.
Example #1:
object GfG
{
def main(args : Array[String])
{
val m 1 = List( 6 , 8 , 9 , 12 )
val result = m 1 .isEmpty
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val m 1 = List()
val result = m 1 .isEmpty
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...