Add groupingBy and eachCount sample.

This commit is contained in:
Ilya Gorbunov
2017-02-28 22:01:27 +03:00
parent 75ae42121b
commit a04e6de047
15 changed files with 42 additions and 0 deletions
@@ -7635,6 +7635,8 @@ public inline fun <K, V, M : MutableMap<in K, MutableList<V>>> CharArray.groupBy
/**
* Creates a [Grouping] source from an array to be used later with one of group-and-fold operations
* using the specified [keySelector] function to extract a key from each element.
*
* @sample samples.collections.Collections.Transformations.groupingByEachCount
*/
@SinceKotlin("1.1")
public inline fun <T, K> Array<out T>.groupingBy(crossinline keySelector: (T) -> K): Grouping<T, K> {
@@ -1183,6 +1183,8 @@ public inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Iterable<T>.gr
/**
* Creates a [Grouping] source from a collection to be used later with one of group-and-fold operations
* using the specified [keySelector] function to extract a key from each element.
*
* @sample samples.collections.Collections.Transformations.groupingByEachCount
*/
@SinceKotlin("1.1")
public inline fun <T, K> Iterable<T>.groupingBy(crossinline keySelector: (T) -> K): Grouping<T, K> {
@@ -648,6 +648,8 @@ public inline fun <T, K, V, M : MutableMap<in K, MutableList<V>>> Sequence<T>.gr
/**
* Creates a [Grouping] source from a sequence to be used later with one of group-and-fold operations
* using the specified [keySelector] function to extract a key from each element.
*
* @sample samples.collections.Collections.Transformations.groupingByEachCount
*/
@SinceKotlin("1.1")
public inline fun <T, K> Sequence<T>.groupingBy(crossinline keySelector: (T) -> K): Grouping<T, K> {
@@ -705,6 +705,8 @@ public inline fun <K, V, M : MutableMap<in K, MutableList<V>>> CharSequence.grou
/**
* Creates a [Grouping] source from a char sequence to be used later with one of group-and-fold operations
* using the specified [keySelector] function to extract a key from each character.
*
* @sample samples.collections.Collections.Transformations.groupingByEachCount
*/
@SinceKotlin("1.1")
public inline fun <K> CharSequence.groupingBy(crossinline keySelector: (Char) -> K): Grouping<Char, K> {