Remove Map.groupBy

This commit is contained in:
Ilya Ryzhenkov
2014-06-09 23:18:41 +04:00
parent 295ce5fdf8
commit 7273f223f4
2 changed files with 0 additions and 21 deletions
@@ -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*
*/