Transforms a collection into a collection of aggregated groups, by applying a supplied element-mapping function to each element, that transforms each one into a key-value
pair, grouping the resulting pairs by key, and finally reducing values in each group applying a suppling 'reduce' function.