Scala Mutable SortedSet max() method
Last Updated :
26 Mar, 2020
In Scala mutable collections, max() method is utilized to find the largest element of all the elements in the SortedSet.
Method Definition: def max: A
Return Type: It returns the largest of all the elements in the SortedSet.
Example #1:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 1 , 2 , 7 , 4 )
val result = s 1 .max
println(result)
}
}
|
Example #2:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 88 , 54 , 63 , 458 , 96 )
val result = s 1 .max
println(result)
}
}
|
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...