Remove Map.groupBy
This commit is contained in:
@@ -311,13 +311,6 @@ public inline fun <T, K> Iterable<T>.groupBy(toKey: (T) -> K): Map<K, List<T>> {
|
||||
return groupByTo(HashMap<K, MutableList<T>>(), toKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of the elements in original collection grouped by the result of given *toKey* function
|
||||
*/
|
||||
public inline fun <V, K> Map<K, V>.groupBy(toKey: (Map.Entry<K, V>) -> K): Map<K, List<Map.Entry<K, V>>> {
|
||||
return groupByTo(HashMap<K, MutableList<Map.Entry<K, V>>>(), toKey)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of the elements in original collection grouped by the result of given *toKey* function
|
||||
*/
|
||||
@@ -452,18 +445,6 @@ public inline fun <T, K> Iterable<T>.groupByTo(map: MutableMap<K, MutableList<T>
|
||||
return map
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends elements from original collection grouped by the result of given *toKey* function to the given *map*
|
||||
*/
|
||||
public inline fun <V, K> Map<K, V>.groupByTo(map: MutableMap<K, MutableList<Map.Entry<K, V>>>, toKey: (Map.Entry<K, V>) -> K): Map<K, MutableList<Map.Entry<K, V>>> {
|
||||
for (element in this) {
|
||||
val key = toKey(element)
|
||||
val list = map.getOrPut(key) { ArrayList<Map.Entry<K, V>>() }
|
||||
list.add(element)
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends elements from original collection grouped by the result of given *toKey* function to the given *map*
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user