minOf
Returns the smallest value among all values produced by selector function applied to each element in the sequence.
inline fun <T> Sequence<T>.minOf(selector: (T) -> Double): Double(source)
data class Product(val name: String, val price: Double)
fun main() {
val products = listOf(
Product("Apple", 1.99),
Product("Banana", 0.99),
Product("Cherry", 2.49)
).asSequence()
val cheapestPrice = products.minOf { it.price }
println("Cheapest price: $cheapestPrice")
}