The keys() method is utilized to give an iterator over all the keys of the SortedMap.
Method Definition: def keys: Iterable[A]
Return Type: It returns an iterator over all the keys of the SortedMap.
Set(cs, for, geeks)
So, the identical keys are taken only once.
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.