分组

    • 计算每个组中的元素。
    • fold() 与 对每个组分别执行 fold 与 reduce 操作,作为一个单独的集合并返回结果。
    1. fun main() {
    2. //sampleStart
    3. println(numbers.groupingBy { it.first() }.eachCount())
    4. //sampleEnd