associateByTo

inline fun <V, M : SparseArray<in V>> Iterable<V>.associateByTo(destination: M, keySelector: (V) -> Int): M

Populates and returns the destination array by populating with keys provided by keySelector and values that are the elements themselves.

For instances where the keys repeat, the last key/value pair will be added to the array.


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

Populates and returns the destination array by populating with keys provided by keySelector and values provided by valueTransform.

For instances where the keys repeat, the last key/value pair will be added to the array.