Scala Mutable SortedSet min() method
Last Updated :
26 Mar, 2020
In Scala mutable collections, min() method is utilized to find the smallest element of all the elements in the stated list.
Method Definition: def min: A
Return Type: It returns the smallest of all the elements in the stated list.
Example #1:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 11 , 22 , 33 )
val result = s 1 .min
println(result)
}
}
|
Example #2:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 11 , 23 , 72 , 14 , 21 , 118 )
val result = s 1 .min
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...