Introduce new overloads of max and min to fix NaN propagation behavior on JVM.

This commit is contained in:
Ilya Gorbunov
2016-12-28 04:08:05 +03:00
parent 74331f8eaa
commit 0bf2ba8701
11 changed files with 557 additions and 61 deletions
@@ -5751,6 +5751,18 @@ public header inline fun BooleanArray.forEachIndexed(action: (Int, Boolean) -> U
*/
public header inline fun CharArray.forEachIndexed(action: (Int, Char) -> Unit): Unit
/**
* Returns the largest element or `null` if there are no elements.
*/
@SinceKotlin("1.1")
public header fun Array<out Double>.max(): Double?
/**
* Returns the largest element or `null` if there are no elements.
*/
@SinceKotlin("1.1")
public header fun Array<out Float>.max(): Float?
/**
* Returns the largest element or `null` if there are no elements.
*/
@@ -5881,6 +5893,18 @@ public header fun BooleanArray.maxWith(comparator: Comparator<in Boolean>): Bool
*/
public header fun CharArray.maxWith(comparator: Comparator<in Char>): Char?
/**
* Returns the smallest element or `null` if there are no elements.
*/
@SinceKotlin("1.1")
public header fun Array<out Double>.min(): Double?
/**
* Returns the smallest element or `null` if there are no elements.
*/
@SinceKotlin("1.1")
public header fun Array<out Float>.min(): Float?
/**
* Returns the smallest element or `null` if there are no elements.
*/