kotlin.collections.associateByTo

associateByTo

inline fun <T, K, M : MutableMap<in K, in T>> Iterable<T>.associateByTo(
    destination: M, 
    keySelector: (T) -> K
): M

Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given collection and value is the element itself.

If any two elements would have the same key returned by keySelector the last one gets added to the map.

inline fun <T, K, V, M : MutableMap<in K, in V>> Iterable<T>.associateByTo(
    destination: M, 
    keySelector: (T) -> K, 
    valueTransform: (T) -> V
): M

Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function and and value is provided by the valueTransform function applied to elements of the given collection.

If any two elements would have the same key returned by keySelector the last one gets added to the map.

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

Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given array and value is the element itself.

If any two elements would have the same key returned by keySelector the last one gets added to the map.

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

Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function and and value is provided by the valueTransform function applied to elements of the given array.

If any two elements would have the same key returned by keySelector 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-by-to.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部