maxWith

Common
JVM
JS
Native
1.0
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?
@ExperimentalUnsignedTypes fun UIntArray.maxWith(
    comparator: Comparator<in UInt>
): UInt?
@ExperimentalUnsignedTypes fun ULongArray.maxWith(
    comparator: Comparator<in ULong>
): ULong?
@ExperimentalUnsignedTypes fun UByteArray.maxWith(
    comparator: Comparator<in UByte>
): UByte?
@ExperimentalUnsignedTypes fun UShortArray.maxWith(
    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.0
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.