+ 6
Kotlin- When minOrNull() returns null?
var arr= arrayOf(1,2,3) print(arr.minOrNull()) The output is 1. When will the minOrNull() extension return null?đ€
2 RĂ©ponses
+ 3
minOrNull() returns null when collection/array is empty
https://kotlinlang.org/docs/collection-aggregate.html
""'
minOrNull() and maxOrNull() return the smallest and the largest element respectively. On empty collections, they return null.
""'
+ 3
Thank you đźđłOmkarđ