maxBy

inline fun <ID : Any, T, R : Comparable<R>> Field<ID, T>.maxBy(reductionType: ReductionType = ExcludingSelf, crossinline selector: (FieldEntry<ID, T>) -> R): FieldEntry<ID, T>?

Returns the entry that yields the largest value according to the given selector.

By default, the local entry is excluded from the comparison. It is included only if reductionType is IncludingSelf.

If multiple entries produce the same maximal value, one is returned arbitrarily. If the field contains no applicable entries, the result is null.

Return

the entry with the highest value as determined by selector, or null if none.

Parameters

reductionType

specifies whether to include the local entry in the comparison (default is ExcludingSelf).

selector

a function that maps each entry to a comparable value.