Implement reduceIndexedOrNull and reduceRightIndexedOrNull #KT-36866

This commit is contained in:
Abduqodiri Qurbonzoda
2020-03-06 13:49:22 +03:00
parent b60633d79a
commit b1fac4e721
13 changed files with 964 additions and 0 deletions
@@ -426,6 +426,10 @@ public class SequenceTest {
expect(null, { sequenceOf<Int>().reduceOrNull { acc, i -> acc + i } })
}
@Test fun reduceIndexedOrNullOnEmpty() {
expect(null, { sequenceOf<Int>().reduceIndexedOrNull { index, acc, i -> acc + i + index } })
}
@Test fun minusElement() = testMinus(expected = listOf("foo", "bar")) { it - "bar" - "zoo" }
@Test fun minusCollection() = testMinus { it - listOf("bar", "zoo") }
@Test fun minusArray() = testMinus { it - arrayOf("bar", "zoo") }