invertedAll

fun <K, V> Map<K, V>.invertedAll(): Map<V, List<K>>

Returns a map from each value to the list of all keys that map to it.

Keys inside each list follow this map's iteration order, and values are ordered by first occurrence. No key is lost, unlike inverted.