mapIndexedTo

abstract fun <R, C : MutableCollectionWrapper<in R>> mapIndexedTo(destination: C, transform: (index: Int, T) -> R): C

将序列中的每个元素应用到指定的转换函数,并将转换后的元素添加到指定的 MutableCollectionWrapper 中,并提供元素的索引。

此函数类似于 Kotlin 标准库中的 mapIndexedTo 函数,但它使用 MutableCollectionWrapper 而不是原始的 MutableCollection

参考 kotlin.sequences.mapIndexedTo

Return

指定的 MutableCollectionWrapper,其中包含添加的元素。

Parameters

destination

用于存储结果的 MutableCollectionWrapper

transform

一个函数,用于将每个元素转换为另一个类型,并提供元素的索引。