fold To
abstract fun <R, M : MutableMapWrapper<in K, R>> foldTo(destination: M, initialValueSelector: (key: K, element: T) -> R, operation: (key: K, accumulator: R, element: T) -> R): M
对每个组应用给定的折叠操作,并将结果存储在提供的 MutableMapWrapper 中。
Return
包含折叠结果的 MutableMapWrapper
Parameters
destination
用于存储折叠结果的 MutableMapWrapper
initial Value Selector
用于为每个组选择初始值的函数,接收 key 和 element 作为参数
operation
折叠操作函数,接收 key、accumulator 和 element 作为参数