merge

fun <K, V> Collection<Map<K, V>>.merge(valueMergeFunction: (List<V>) -> V): Map<K, V>

Merges the given Collection of type-equivalent Maps together, while grouping the values of each key together and finally applying the given lambds to each value to merge the list of values of each key into a single value such that the returned map has the same type-signature again.