KT-33761 Add reduceOrNull
This commit is contained in:
committed by
Ilya Gorbunov
parent
39e1b24c2c
commit
f5d696d3c4
@@ -315,6 +315,15 @@ class CollectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test fun reduceOrNull() {
|
||||
expect("1234") {
|
||||
val list = listOf("1", "2", "3", "4")
|
||||
list.reduceOrNull { a, b -> a + b }
|
||||
}
|
||||
|
||||
expect(null, { arrayListOf<Int>().reduceOrNull { a, b -> a + b } })
|
||||
}
|
||||
|
||||
@Test fun reduceRight() {
|
||||
expect("1234") {
|
||||
val list = listOf("1", "2", "3", "4")
|
||||
|
||||
Reference in New Issue
Block a user