minOfOrNull
Returns the smallest value among all values produced by selector function applied to each element in the array or null if the array is empty.
inline fun <T> Array<out T>.minOfOrNull(selector: (T) -> Double): Double?(source)
data class Product(val name: String, val price: Double)
fun main() {
val products = arrayOf(
Product("Apple", 1.99),
Product("Banana", 0.99),
Product("Cherry", 2.49)
)
val cheapestPrice = products.minOfOrNull { it.price }
println("Cheapest price: $cheapestPrice")
}