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
@@ -849,6 +849,7 @@ object Aggregates : TemplateGroupBase() {
specialFor(ArraysOfUnsigned) { inlineOnly() }
doc { "Accumulates value starting with the first ${f.element} and applying [operation] from left to right to current accumulator value and each ${f.element}. Returns null if the ${f.collection} is empty." }
sample("samples.collections.Collections.Aggregates.reduceOrNull")
returns("T?")
body {
"""
@@ -872,6 +873,7 @@ object Aggregates : TemplateGroupBase() {
inline()
doc { "Accumulates value starting with the first ${f.element} and applying [operation] from left to right to current accumulator value and each ${f.element}. Returns null if the ${f.collection} is empty." }
sample("samples.collections.Collections.Aggregates.reduceOrNull")
typeParam("S")
typeParam("T : S")
returns("S?")
@@ -970,6 +972,7 @@ object Aggregates : TemplateGroupBase() {
specialFor(ArraysOfUnsigned) { inlineOnly() }
doc { "Accumulates value starting with last ${f.element} and applying [operation] from right to left to each ${f.element} and current accumulator value. Returns null if the ${f.collection} is empty." }
sample("samples.collections.Collections.Aggregates.reduceRightOrNull")
returns("T?")
body {
"""
@@ -993,6 +996,7 @@ object Aggregates : TemplateGroupBase() {
annotation("@ExperimentalStdlibApi")
inline()
doc { "Accumulates value starting with last ${f.element} and applying [operation] from right to left to each ${f.element} and current accumulator value. Returns null if the ${f.collection} is empty." }
sample("samples.collections.Collections.Aggregates.reduceRightOrNull")
typeParam("S")
typeParam("T : S")
returns("S?")