The toList() method is utilized to display the elements of the map in the list.
Method Definition: def toList: List[A]
Return Type: It returns all the elements of the map in the list.
List((3, geeks), (4, for), (2, cs))
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.