maxWithOrNull

Common
JVM
JS
Native
1.4
fun <T> Array<out T>.maxWithOrNull(
    comparator: Comparator<in T>
): T?
fun ByteArray.maxWithOrNull(
    comparator: Comparator<in Byte>
): Byte?
fun ShortArray.maxWithOrNull(
    comparator: Comparator<in Short>
): Short?
fun IntArray.maxWithOrNull(
    comparator: Comparator<in Int>
): Int?
fun LongArray.maxWithOrNull(
    comparator: Comparator<in Long>
): Long?
fun FloatArray.maxWithOrNull(
    comparator: Comparator<in Float>
): Float?
fun DoubleArray.maxWithOrNull(
    comparator: Comparator<in Double>
): Double?
fun BooleanArray.maxWithOrNull(
    comparator: Comparator<in Boolean>
): Boolean?
fun CharArray.maxWithOrNull(
    comparator: Comparator<in Char>
): Char?
fun <T> Iterable<T>.maxWithOrNull(
    comparator: Comparator<in T>
): T?
@ExperimentalUnsignedTypes fun UIntArray.maxWithOrNull(
    comparator: Comparator<in UInt>
): UInt?
@ExperimentalUnsignedTypes fun ULongArray.maxWithOrNull(
    comparator: Comparator<in ULong>
): ULong?
@ExperimentalUnsignedTypes fun UByteArray.maxWithOrNull(
    comparator: Comparator<in UByte>
): UByte?
@ExperimentalUnsignedTypes fun UShortArray.maxWithOrNull(
    comparator: Comparator<in UShort>
): UShort?

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.4
fun <K, V> Map<out K, V>.maxWithOrNull(
    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.