max

Common
JS
Native
1.7
@JvmName("maxOrThrow") fun Array<out Double>.max(): Double
(source)
JVM
1.1
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun Array<out Double>.max(): Double?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun Array<out Float>.max(): Float
(source)
JVM
1.1
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun Array<out Float>.max(): Float?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun FloatArray.max(): Float
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun FloatArray.max(): Float?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun DoubleArray.max(): Double
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun DoubleArray.max(): Double?
(source)
Deprecated: Use maxOrNull instead.

Returns the largest element.

If any of elements is NaN returns NaN.

Exceptions

NoSuchElementException - if the array is empty.

Common
JS
Native
1.7
@JvmName("maxOrThrow") fun <T : Comparable<T>> Array<out T>.max(): T
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun <T : Comparable<T>> Array<out T>.max(): T?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun ByteArray.max(): Byte
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun ByteArray.max(): Byte?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun ShortArray.max(): Short
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun ShortArray.max(): Short?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun IntArray.max(): Int
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun IntArray.max(): Int?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun LongArray.max(): Long
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun LongArray.max(): Long?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun CharArray.max(): Char
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun CharArray.max(): Char?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow-U") @ExperimentalUnsignedTypes fun UIntArray.max(): UInt
(source)
JVM
1.3
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes fun UIntArray.max(): UInt?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow-U") @ExperimentalUnsignedTypes fun ULongArray.max(): ULong
(source)
JVM
1.3
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes fun ULongArray.max(): ULong?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow-U") @ExperimentalUnsignedTypes fun UByteArray.max(): UByte
(source)
JVM
1.3
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes fun UByteArray.max(): UByte?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow-U") @ExperimentalUnsignedTypes fun UShortArray.max(): UShort
(source)
JVM
1.3
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") @ExperimentalUnsignedTypes fun UShortArray.max(): UShort?
(source)
Deprecated: Use maxOrNull instead.

Returns the largest element.

Exceptions

NoSuchElementException - if the array is empty.

Common
JS
Native
1.7
@JvmName("maxOrThrow") fun Iterable<Double>.max(): Double
(source)
JVM
1.1
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun Iterable<Double>.max(): Double?
(source)
Deprecated: Use maxOrNull instead.
Common
JS
Native
1.7
@JvmName("maxOrThrow") fun Iterable<Float>.max(): Float
(source)
JVM
1.1
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun Iterable<Float>.max(): Float?
(source)
Deprecated: Use maxOrNull instead.

Returns the largest element.

If any of elements is NaN returns NaN.

Exceptions

NoSuchElementException - if the collection is empty.

Common
JS
Native
1.7
@JvmName("maxOrThrow") fun <T : Comparable<T>> Iterable<T>.max(): T
(source)
JVM
1.0
@DeprecatedSinceKotlin("1.4", "1.5", "1.6") fun <T : Comparable<T>> Iterable<T>.max(): T?
(source)
Deprecated: Use maxOrNull instead.

Returns the largest element.

Exceptions

NoSuchElementException - if the collection is empty.