English | 简体中文

api-docs / org.ktorm.entity / reduceOrNull

reduceOrNull

inline fun <E : Any> EntitySequence<E, *>.reduceOrNull(
    operation: (acc: E, E) -> E
): E?
(source code)

Accumulate value starting with the first element and applying operation from left to right to current accumulator
value and each element.

Returns null if the sequence is empty.

The operation function takes the current accumulator value and an element, and calculates the next
accumulator value.

The operation is terminal.

Since
3.1.0