Scala ListSet size() method with example
Last Updated :
13 Feb, 2023
In Scala ListSet, size() method is utilized to find the number of elements of the stated listSet.
Method Definition: def size(): Int Return Type: It returns the number of elements in the stated listSet.
Example 1:
Scala
import scala.collection.immutable. _
object GfG
{
def main(args : Array[String])
{
val m 1 = ListSet( 1 , 2 , 3 , 4 , 5 )
val result = m 1 .size
println(result)
}
}
|
Example 2:
Scala
import scala.collection.immutable. _
object GfG
{
def main(args : Array[String])
{
val m 1 = ListSet( 1 , 2 )
val result = m 1 .size
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...