Files
kotlin-fork/idea/testData/intentions/loopToCallChain/sum/indexUsed.kt.after
T
Valentin Kipyatkov d0f6e25783 sum and sumBy supported
2016-08-23 22:47:42 +03:00

10 lines
287 B
Plaintext
Vendored

// WITH_RUNTIME
// INTENTION_TEXT: "Replace with 'mapIndexed{}.sum()'"
// INTENTION_TEXT_2: "Replace with 'asSequence().mapIndexed{}.sum()'"
fun foo(list: List<Int>): Int {
val <caret>s = list
.mapIndexed { index, item -> item * index }
.sum()
return s
}