The toList() method is utilized to display the elements of the SortedMap in the list.
Method Definition: def toList: List[A]
Return Type: It returns all the elements of the SortedMap in the list.
List((2, cs), (3, geeks), (4, for))
List((3, geeks), (4, for))
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.