kotlin.collections.associateTo

associateTo

inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateTo(
    destination: M, 
    transform: (T) -> Pair<K, V>
): M

Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given collection.

If any of two pairs would have the same key the last one gets added to the map.

inline fun <T, K, V, M : MutableMap<in K, in V>> Array<out T>.associateTo(
    destination: M, 
    transform: (T) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> ByteArray.associateTo(
    destination: M, 
    transform: (Byte) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> ShortArray.associateTo(
    destination: M, 
    transform: (Short) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> IntArray.associateTo(
    destination: M, 
    transform: (Int) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> LongArray.associateTo(
    destination: M, 
    transform: (Long) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> FloatArray.associateTo(
    destination: M, 
    transform: (Float) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> DoubleArray.associateTo(
    destination: M, 
    transform: (Double) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> BooleanArray.associateTo(
    destination: M, 
    transform: (Boolean) -> Pair<K, V>
): M
inline fun <K, V, M : MutableMap<in K, in V>> CharArray.associateTo(
    destination: M, 
    transform: (Char) -> Pair<K, V>
): M

Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given array.

If any of two pairs would have the same key the last one gets added to the map.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/associate-to.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部