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