Scala ListSet min() method with example
Last Updated :
14 Feb, 2023
In Scala ListSet, min() method is utilized to find the smallest element of all the elements in the stated list.
Method Definition: def min[B >: A](implicit ord: math.Ordering[B]): A Return Type: It returns the smallest of all the 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 )
val result = m 1 .min
println(result)
}
}
|
Example 2:
Scala
import scala.collection.immutable. _
object GfG
{
def main(args : Array[String])
{
val m 1 = ListSet( 1 , 2 , - 3 )
val result = m 1 .min
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...