selectByMax

suspend fun <T : Comparable<T>> selectByMax(function: suspend (Output) -> T): ParallelNodeExecutionResult<Output>(source)

Selects the maximum result based on a given comparison function and returns the corresponding NodeExecutionResult containing the selected output and its associated context.

Return

The NodeExecutionResult containing the output and context of the result with the maximum value as determined by the comparison function.

Parameters

function

A lambda function to extract a comparable value from the Output object for determining the maximum result.

Throws

if the results list is empty.