English | 简体中文

api-docs / org.ktorm.dsl / associateBy

associateBy

inline fun <K, V> Query.associateBy(
    keySelector: (row: QueryRowSet) -> K,
    valueTransform: (row: QueryRowSet) -> V
): Map<K, V>
(source code)

Return a Map containing the values provided by valueTransform and indexed by keySelector functions applied to
rows of the query.

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

The returned map preserves the entry iteration order of the original query results.

Since
3.0.0