maxWith

fun <ID : Any, T> Field<ID, T>.maxWith(reductionType: ReductionType = ExcludingSelf, comparator: Comparator<FieldEntry<ID, T>>): FieldEntry<ID, T>?

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

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

If multiple entries are considered equal under the comparator, one of them is returned arbitrarily. If the field contains no applicable entries, the result is null.

Return

the entry with the greatest value, or null if none.

Parameters

reductionType

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

comparator

the comparator used to determine ordering between entries.