maxWith

Common
JVM
JS
Native
1.7
@JvmName("maxWithOrThrow") fun <T> Sequence<T>.maxWith(
    comparator: Comparator<in T>
): T

(source)

Returns the first element having the largest value according to the provided comparator.

The operation is terminal.

Exceptions

NoSuchElementException - if the sequence is empty.

JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun <T> Sequence<T>.maxWith(
    comparator: Comparator<in T>
): T?

(source)
Deprecated: Use maxWithOrNull instead.