English | 简体中文

api-docs / org.ktorm.entity / associateWithTo

associateWithTo

inline fun <K : Entity<K>, V, M : MutableMap<in K, in V>> EntitySequence<K, *>.associateWithTo(
    destination: M,
    valueSelector: (K) -> V
): M
(source code)

Populate and return the destination mutable map with key-value pairs for each element of the given sequence,
where key is the element itself and value is provided by the valueSelector function applied to that key.

If any two elements are equal, the last one overwrites the former value in the map.

The operation is terminal.