Specify which element Iterable.distinctBy(selector) retains #KT-36356

This commit is contained in:
Abduqodiri Qurbonzoda
2020-02-19 03:25:01 +03:00
parent fb49a586ef
commit f9ee1dc22d
4 changed files with 14 additions and 2 deletions
@@ -5,6 +5,10 @@
package templates
import templates.DocExtensions.collection
import templates.DocExtensions.element
import templates.DocExtensions.mapResult
import templates.DocExtensions.pluralize
import templates.Family.*
import templates.SequenceClass.*
@@ -52,7 +56,8 @@ object SetOps : TemplateGroupBase() {
doc {
"""
Returns a ${f.mapResult} containing only distinct ${f.element.pluralize()} from the given ${f.collection}.
${if (f.isPrimitiveSpecialization) "" else "\n" +
"Among equal ${f.element.pluralize()} of the given ${f.collection}, only the first one will be present in the resulting ${f.mapResult}."}
The ${f.element.pluralize()} in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}.
"""
}
@@ -74,7 +79,8 @@ object SetOps : TemplateGroupBase() {
"""
Returns a ${f.mapResult} containing only ${f.element.pluralize()} from the given ${f.collection}
having distinct keys returned by the given [selector] function.
${if (f.isPrimitiveSpecialization) "" else "\n" +
"Among ${f.element.pluralize()} of the given ${f.collection} with equal keys, only the first one will be present in the resulting ${f.mapResult}."}
The ${f.element.pluralize()} in the resulting ${f.mapResult} are in the same order as they were in the source ${f.collection}.
"""
}