Scala Mutable SortedSet mkString() method
Last Updated :
26 Mar, 2020
In Scala mutable collections, mkString() method is utilized to display all elements of the SortedSet in a string.
Method Definition: def mkString: String
Return Type: It returns a string containing all the element of the SortedSet.
Example #1:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 121 , 2242 , 331 , 400 )
val result = s 1 .mkString
println(result)
}
}
|
Example #2:
import scala.collection.mutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( "Geeks" , "Will" , "Rule" )
val result = s 1 .mkString
println(result)
}
}
|
Share your thoughts in the comments
Please Login to comment...