KT-20357: Add samples for filter functions
This commit is contained in:
committed by
Abduqodiri Qurbonzoda
parent
ca6e430e89
commit
1009a240f2
@@ -578,6 +578,7 @@ object Filtering : TemplateGroupBase() {
|
||||
specialFor(ArraysOfUnsigned) { inlineOnly() }
|
||||
|
||||
doc { "Appends all ${f.element.pluralize()} matching the given [predicate] to the given [destination]." }
|
||||
sample("samples.collections.Collections.Filtering.filterTo")
|
||||
typeParam("C : TCollection")
|
||||
returns("C")
|
||||
|
||||
@@ -613,6 +614,7 @@ object Filtering : TemplateGroupBase() {
|
||||
and returns the result of predicate evaluation on the ${f.element}.
|
||||
"""
|
||||
}
|
||||
sample("samples.collections.Collections.Filtering.filterIndexed")
|
||||
returns("List<T>")
|
||||
body {
|
||||
"""
|
||||
@@ -657,6 +659,7 @@ object Filtering : TemplateGroupBase() {
|
||||
@param [predicate] function that takes the index of ${f.element.prefixWithArticle()} and the ${f.element} itself
|
||||
and returns the result of predicate evaluation on the ${f.element}.
|
||||
""" }
|
||||
sample("samples.collections.Collections.Filtering.filterIndexedTo")
|
||||
typeParam("C : TCollection")
|
||||
returns("C")
|
||||
|
||||
@@ -709,6 +712,7 @@ object Filtering : TemplateGroupBase() {
|
||||
specialFor(ArraysOfUnsigned) { inlineOnly() }
|
||||
|
||||
doc { "Appends all elements not matching the given [predicate] to the given [destination]." }
|
||||
sample("samples.collections.Collections.Filtering.filterTo")
|
||||
typeParam("C : TCollection")
|
||||
returns("C")
|
||||
|
||||
@@ -760,6 +764,7 @@ object Filtering : TemplateGroupBase() {
|
||||
include(Iterables, Sequences, ArraysOfObjects)
|
||||
} builder {
|
||||
doc { "Appends all elements that are not `null` to the given [destination]." }
|
||||
sample("samples.collections.Collections.Filtering.filterNotNullTo")
|
||||
returns("C")
|
||||
typeParam("C : TCollection")
|
||||
typeParam("T : Any")
|
||||
@@ -776,6 +781,7 @@ object Filtering : TemplateGroupBase() {
|
||||
include(Iterables, Sequences, ArraysOfObjects)
|
||||
} builder {
|
||||
doc { "Appends all elements that are instances of specified type parameter R to the given [destination]." }
|
||||
sample("samples.collections.Collections.Filtering.filterIsInstanceTo")
|
||||
typeParam("reified R")
|
||||
typeParam("C : MutableCollection<in R>")
|
||||
inline()
|
||||
@@ -793,6 +799,7 @@ object Filtering : TemplateGroupBase() {
|
||||
include(Iterables, Sequences, ArraysOfObjects)
|
||||
} builder {
|
||||
doc { "Returns a list containing all elements that are instances of specified type parameter R." }
|
||||
sample("samples.collections.Collections.Filtering.filterIsInstance")
|
||||
typeParam("reified R")
|
||||
returns("List<@kotlin.internal.NoInfer R>")
|
||||
inline()
|
||||
@@ -820,6 +827,7 @@ object Filtering : TemplateGroupBase() {
|
||||
include(Iterables, ArraysOfObjects, Sequences)
|
||||
} builder {
|
||||
doc { "Appends all elements that are instances of specified class to the given [destination]." }
|
||||
sample("samples.collections.Collections.Filtering.filterIsInstanceToJVM")
|
||||
genericStarProjection = true
|
||||
typeParam("C : MutableCollection<in R>")
|
||||
typeParam("R")
|
||||
@@ -838,6 +846,7 @@ object Filtering : TemplateGroupBase() {
|
||||
include(Iterables, ArraysOfObjects, Sequences)
|
||||
} builder {
|
||||
doc { "Returns a list containing all elements that are instances of specified class." }
|
||||
sample("samples.collections.Collections.Filtering.filterIsInstanceJVM")
|
||||
genericStarProjection = true
|
||||
typeParam("R")
|
||||
returns("List<R>")
|
||||
|
||||
Reference in New Issue
Block a user