The filter() method is utilized to select all elements of the map which satisfies a stated predicate.
Method Definition: def filter(p: ((A, B))=> Boolean): Map[A, B]
Return Type: It returns a new map consisting all the elements of the map which satisfies the given predicate.
Map(geeks -> 5)
Here, an empty map is returned as none of the elements satisfy the stated predicate.