flatMapIndexedTo

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

将对原始可迭代对象中每个元素应用给定 transform 函数的结果添加到 destination 中, 并提供元素的索引。

Return

destination,以便链式调用。

Parameters

destination

用于存储结果的 MutableCollectionWrapper

transform

用于将每个元素转换为结果的函数,接收元素的索引和元素本身作为参数。