The count() method is utilized to count pair of keys in the SortedMap.
Method Definition: def count(p: ((A, B)) => Boolean): Int
Return Type: It returns the number of keys present in the SortedMap that satisfies the given predicate.
So, the identical keys are counted 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.