Files
kotlin-fork/idea/testData/intentions/loopToCallChain/maxMin/max6.kt
T
2021-04-07 07:49:23 +03:00

11 lines
331 B
Kotlin
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.maxOrNull()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.maxOrNull()'"
fun getMaxLineWidth(list: List<Double>): Double {
var max = 0.0
<caret>for ((i, item) in list.withIndex()) {
max = Math.max(max, item * i)
}
return max
}