Use list iterators instead of indexed access in operations on lists taking a lambda.

Related to #KT-9607
This commit is contained in:
Ilya Gorbunov
2016-02-11 23:54:49 +03:00
parent b743e71cfc
commit f4f82656f7
5 changed files with 217 additions and 45 deletions
@@ -54,6 +54,13 @@ class ListSpecificTest {
assertEquals(1, data.lastIndex)
}
@Test
fun indexOfLast() {
expect(-1) { data.indexOfLast { it.contains("p") } }
expect(1) { data.indexOfLast { it.length == 3 } }
expect(-1) { empty.indexOfLast { it.startsWith('f') } }
}
@Test
fun mutableList() {
val items = listOf("beverage", "location", "name")