Scala Mutable SortedMap empty() method with example
Last Updated :
04 May, 2020
The empty() method is utilized to make the SortedMap empty.
Method Definition: def empty: SortedMap[A, B]
Return Type: It returns an empty SortedMap.
Example #1:
import scala.collection.SortedMap
object GfG
{
def main(args : Array[String])
{
val m 1 = SortedMap( "geeks" - > 5 , "for" - > 3 , "cs" - > 2 )
val result = m 1 .empty
println(result)
}
}
|
Example #2:
import scala.collection.SortedMap
object GfG
{
def main(args : Array[String])
{
val m 1 = SortedMap( "gopal" - > 10 )
val result = m 1 .empty
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...