Relax upper bound of T for minBy and maxBy to be nullable.
Swap type parameters of minBy and maxBy. #KT-10099 Fixed
This commit is contained in:
@@ -8359,7 +8359,7 @@ public fun ShortArray.max(): Short? {
|
||||
/**
|
||||
* Returns the first element yielding the largest value of the given function or `null` if there are no elements.
|
||||
*/
|
||||
public inline fun <R : Comparable<R>, T : Any> Array<out T>.maxBy(selector: (T) -> R): T? {
|
||||
public inline fun <T, R : Comparable<R>> Array<out T>.maxBy(selector: (T) -> R): T? {
|
||||
if (isEmpty()) return null
|
||||
var maxElem = this[0]
|
||||
var maxValue = selector(maxElem)
|
||||
@@ -8625,7 +8625,7 @@ public fun ShortArray.min(): Short? {
|
||||
/**
|
||||
* Returns the first element yielding the smallest value of the given function or `null` if there are no elements.
|
||||
*/
|
||||
public inline fun <R : Comparable<R>, T : Any> Array<out T>.minBy(selector: (T) -> R): T? {
|
||||
public inline fun <T, R : Comparable<R>> Array<out T>.minBy(selector: (T) -> R): T? {
|
||||
if (isEmpty()) return null
|
||||
var minElem = this[0]
|
||||
var minValue = selector(minElem)
|
||||
|
||||
Reference in New Issue
Block a user