associateByTo

inline fun <K, M : MutableMap<in K, in Char>> CharSequence.associateByTo(
    destination: M,
    keySelector: (Char) -> K
): M
(source)

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

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

inline fun <K, V, M : MutableMap<in K, in V>> CharSequence.associateByTo(
    destination: M,
    keySelector: (Char) -> K,
    valueTransform: (Char) -> V
): M
(source)

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 characters of the given char sequence.

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