English | 简体中文

api-docs / org.ktorm.entity / reduceTo

reduceTo

inline fun <E : Any, K : Any, M : MutableMap<in K?, E>> EntityGrouping<E, *, K>.reduceTo(
    destination: M,
    operation: (key: K?, accumulator: E, element: E) -> E
): M
(source code)

Groups elements from the source sequence by key and applies the reducing operation to the elements of each group
sequentially starting from the second element of the group, passing the previously accumulated value and the current
element as arguments, and stores the results in the given destination map. An initial value of accumulator is the
first element of the group.

This function is delegated to Grouping.reduceTo, more details can be found in its documentation.