<Map() processed all items and can be very slow> I...
# forum
r
Map() processed all items and can be very slow I am working with huge lists and have some performance problems: I narrowed it down to the following code: var counter1 = 0 var counter2 = 0 val list = ArrayList(100) for (i in 0 until 100) list.add(Point(i, 0)) list.map { it.x ++counter1 }.subList(0, 5).forEach { ++counter2 } Log.i("XXXXXXXXXXXXX", "counter1 == $counter1, counter2 == $counter2") I expected the output to be: I/XXXXXXXXXXXXX: counter1 == 5 counter2 == 5 But it actually...