maxOrNull

Returns the largest element or null if the array is empty.

If any of elements is NaN, this function returns NaN.

Since Kotlin

1.4

Samples


fun <T : Comparable<T>> Array<out T>.maxOrNull(): T?(source)

Returns the largest element or null if the array is empty.

If there are multiple equal maximal elements, this function returns the first of those elements.

Since Kotlin

1.4

Samples


Returns the largest element or null if the array is empty.

Since Kotlin

1.4

Samples


Returns the largest element or null if the collection is empty.

If any of elements is NaN, this function returns NaN.

Since Kotlin

1.4

Samples


Returns the largest element or null if the collection is empty.

If there are multiple equal maximal elements, this function returns the first of those elements.

Since Kotlin

1.4

Samples