associateTo

abstract fun <K, V, M : MutableMapWrapper<in K, in V>> associateTo(destination: M, transform: (T) -> Pair<K, V>): M

将序列中的每个元素转换为一个键值对,并将结果添加到指定的 MutableMapWrapper 中。

此函数类似于 Kotlin 标准库中的 associateTo 函数,但它使用 MutableMapWrapper 而不是原始的 MutableMap

参考 kotlin.sequences.associateTo

Return

指定的 MutableMapWrapper,其中包含添加的元素及其对应的键值对。

Parameters

destination

用于存储结果的 MutableMapWrapper

transform

一个函数,它接收序列的每个元素作为参数,并返回一个键值对。