The dropRight() method is utilized to delete the last ‘n’ elements.
Method Definition: def dropRight(n: Int): SortedMap[A, B]
Return Type: It returns all the elements of the SortedMap except the last ‘n’ elements.
Map(cs -> 5, for -> 3)
So, here an empty SortedMap is returned as all the elements of the SortedMap are deleted.
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.