English | 简体中文

api-docs / org.ktorm.entity / associateWith

associateWith

inline fun <K : Entity<K>, V> EntitySequence<K, *>.associateWith(
    valueSelector: (K) -> V
): Map<K, V>
(source code)

Return a Map where keys are elements from the given sequence and values are produced by the valueSelector
function applied to each element.

If any two elements are equal, the last one gets added to the map.

The returned map preserves the entry iteration order of the original sequence.

The operation is terminal.