Introduce filterIndexed

#KT-9502 Fixed
This commit is contained in:
Ilya Gorbunov
2015-11-07 17:55:33 +03:00
parent ee759c10c8
commit 008a8059cf
9 changed files with 310 additions and 27 deletions
@@ -146,6 +146,11 @@ abstract class IterableTests<T : Iterable<String>>(val data: T, val empty: T) {
assertEquals(listOf("foo"), foo)
}
@Test fun filterIndexed() {
val result = data.filterIndexed { index, value -> value.first() == ('a' + index) }
assertEquals(listOf("bar"), result)
}
@Test
fun drop() {
val foo = data.drop(1)