W3cubDocs

/Kotlin

maxWith

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

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

© 2010–2019 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/max-with.html