groupBy
trait Collection[A] { def groupBy[K](f: (A) => K): Map[K, Collection[A]] }
groupBy creates a Map by grouping the elements under the key they yield when the function f is applied to them.
Map
f