Improve groupingBy samples

This commit is contained in:
Ilya Gorbunov
2018-09-28 18:17:51 +03:00
parent 3a40e3f041
commit 12a31637d1
2 changed files with 48 additions and 67 deletions
@@ -44,7 +44,7 @@ public interface Grouping<T, out K> {
* - `first`: indicates whether it's the first `element` encountered in the group.
*
* @return a [Map] associating the key of each group with the result of aggregation of the group elements.
* @sample samples.collections.Grouping.aggregateEvenAndOdd
* @sample samples.collections.Grouping.aggregateByRadix
*/
@SinceKotlin("1.1")
public inline fun <T, K, R> Grouping<T, K>.aggregate(
@@ -70,7 +70,7 @@ public inline fun <T, K, R> Grouping<T, K>.aggregate(
* then the elements being aggregated for that key are never considered as `first`.
*
* @return the [destination] map associating the key of each group with the result of aggregation of the group elements.
* @sample samples.collections.Grouping.aggregateEvenAndOddTo
* @sample samples.collections.Grouping.aggregateByRadixTo
*/
@SinceKotlin("1.1")
public inline fun <T, K, R, M : MutableMap<in K, R>> Grouping<T, K>.aggregateTo(
@@ -202,7 +202,7 @@ public inline fun <T, K, R, M : MutableMap<in K, R>> Grouping<T, K>.foldTo(
* - `element`: the element from the source being accumulated.
*
* @return a [Map] associating the key of each group with the result of accumulating the group elements.
* @sample samples.collections.Grouping.reduceByMaxOfContainsVowels
* @sample samples.collections.Grouping.reduceByMaxVowels
*/
@SinceKotlin("1.1")
public inline fun <S, T : S, K> Grouping<T, K>.reduce(
@@ -229,7 +229,7 @@ public inline fun <S, T : S, K> Grouping<T, K>.reduce(
* - `element`: the element from the source being folded;
*
* @return the [destination] map associating the key of each group with the result of accumulating the group elements.
* @sample samples.collections.Grouping.reduceByMaxOfContainsVowelsTo
* @sample samples.collections.Grouping.reduceByMaxVowelsTo
*/
@SinceKotlin("1.1")
public inline fun <S, T : S, K, M : MutableMap<in K, S>> Grouping<T, K>.reduceTo(