maxWith

Common
JVM
JS
Native
1.2
fun <T> Array<out T>.maxWith(
    comparator: Comparator<in T>
): T?
fun ByteArray.maxWith(comparator: Comparator<in Byte>): Byte?
fun ShortArray.maxWith(
    comparator: Comparator<in Short>
): Short?
fun IntArray.maxWith(comparator: Comparator<in Int>): Int?
fun LongArray.maxWith(comparator: Comparator<in Long>): Long?
fun FloatArray.maxWith(
    comparator: Comparator<in Float>
): Float?
fun DoubleArray.maxWith(
    comparator: Comparator<in Double>
): Double?
fun BooleanArray.maxWith(
    comparator: Comparator<in Boolean>
): Boolean?
fun CharArray.maxWith(comparator: Comparator<in Char>): Char?
fun <T> Iterable<T>.maxWith(comparator: Comparator<in T>): T?

Returns the first element having the largest value according to the provided comparator or null if there are no elements.

Common
JVM
JS
Native
1.2
fun <K, V> Map<out K, V>.maxWith(
    comparator: Comparator<in Entry<K, V>>
): Entry<K, V>?

Returns the first entry having the largest value according to the provided comparator or null if there are no entries.