Scala SortedSet mkString() method with example
Last Updated :
03 Nov, 2019
The 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.immutable.SortedSet
object GfG
{
def main(args : Array[String])
{
val s 1 = SortedSet( 1 , 2 , 3 , 4 )
val result = s 1 .mkString
println(result)
}
}
|
Example #2:
import scala.collection.immutable.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...