Why does the `.max()` and `.min()` methods have be...
# stdlib
a
Why does the
.max()
and
.min()
methods have been removed ?
b
Ambiguous and replaced by minOrNull and maxOrNull
Assuming you're talking about Collection extensions
👍 1
e
https://kotlinlang.org/docs/whatsnew14.html#new-functions-for-arrays-and-collections
• The 
min()
 and 
max()
 functions have been renamed to 
minOrNull()
 and 
maxOrNull()
 to comply with the naming convention used across the Kotlin collections API. An 
*OrNull
 suffix in the function name means that it returns 
null
 if the receiver collection is empty. The same applies to 
minBy()
maxBy()
minWith()
maxWith()
 – in 1.4, they have 
*OrNull()
 synonyms.
the plan is that, in a future release,
min()
and
max()
will return with non-null types, but they need to be hidden for at least a whole release cycle first to ensure a safe transition
🆒 1
a
Okay thanks !