https://kotlinlang.org logo
Title
m

mike_shysh

12/13/2017, 6:44 PM
The lambda expression is unused. If you mean a block, you can use 'run {...} '
g

gildor

12/13/2017, 6:46 PM
customersModels.forEachIndexed { i, customerModel ->
        val times = customerNumbers.getOrElse(i) { 1 }
        repeat(times) {
            add(customerModel)
        }
    }
m

mike_shysh

12/13/2017, 6:47 PM
oh yes, I have an odd block {}
Thank you for all your help
g

gildor

12/13/2017, 6:50 PM
NP
Also, there is a more idiomatic, but less efficient way:
(customerNumbers zip customersModels).forEach {(times, model) ->
        repeat(times) {
            add(model)
        }
    }