Use list iterators instead of indexed access in operations on lists taking a lambda.
Related to #KT-9607
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user