Add sample for reduceOrNull and reduceRightOrNull

This commit is contained in:
Alfredo Delli Bovi
2019-12-13 19:17:04 +01:00
committed by Ilya Gorbunov
parent 06008c40ab
commit 9546307243
7 changed files with 82 additions and 0 deletions
@@ -1197,6 +1197,8 @@ public inline fun CharSequence.reduceIndexed(operation: (index: Int, acc: Char,
/**
* Accumulates value starting with the first character and applying [operation] from left to right to current accumulator value and each character. Returns null if the char sequence is empty.
*
* @sample samples.collections.Collections.Aggregates.reduceOrNull
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi
@@ -1242,6 +1244,8 @@ public inline fun CharSequence.reduceRightIndexed(operation: (index: Int, Char,
/**
* Accumulates value starting with last character and applying [operation] from right to left to each character and current accumulator value. Returns null if the char sequence is empty.
*
* @sample samples.collections.Collections.Aggregates.reduceRightOrNull
*/
@SinceKotlin("1.3")
@ExperimentalStdlibApi