Scala Set min() method with example
Last Updated :
18 Oct, 2019
The max() 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:
object GfG
{
def main(args : Array[String])
{
val s 1 = Set( 1 , 2 , 3 )
val result = s 1 .min
println(result)
}
}
|
Example #2:
object GfG
{
def main(args : Array[String])
{
val s 1 = Set( 5 , 11 , 23 , 72 , 14 , 21 , 118 )
val result = s 1 .min
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...