maxWithOrNull

Platform and version requirements: JVM (1.4), JS (1.4), 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.

Platform and version requirements: JVM (1.4), JS (1.4), 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.

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/max-with-or-null.html