Hold back eachSumOf for a while.

This commit is contained in:
Ilya Gorbunov
2017-01-11 16:48:28 +03:00
parent 0dfcbdf072
commit 4816474d70
3 changed files with 7 additions and 3 deletions
+3 -1
View File
@@ -24,6 +24,7 @@ package kotlin.collections
public fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int> =
fold(0) { acc, e -> acc + 1 }
/**
/**
* Groups elements from the [Grouping] source by key and sums values provided by the [valueSelector] function for elements in each group.
*
@@ -31,4 +32,5 @@ public fun <T, K> Grouping<T, K>.eachCount(): Map<K, Int> =
*/
@SinceKotlin("1.1")
public inline fun <T, K> Grouping<T, K>.eachSumOf(valueSelector: (T) -> Int): Map<K, Int> =
fold(0) { acc, e -> acc + valueSelector(e) }
fold(0) { acc, e -> acc + valueSelector(e) }
*/