Scala mutable SortedSet apply() method
Last Updated :
22 Apr, 2020
In Scala mutable collection apply() method is utilized to test if some elements are exist in the SortedSet.
Method Definition: def apply(elem: A)
Return Type: It returns true if some elements are present in the SortedSet else it returns false.
Example #1:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 1 , 2 , 3 , 4 , 5 )
val result = s 1 .apply( 3 )
println(result)
}
}
|
Example #2:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 1 , 2 , 3 , 4 , 5 )
val result = s 1 .apply( 10 )
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...