Decorate-sort-undecorate idiom: Difference between revisions
Content added Content deleted
Line 596: | Line 596: | ||
=={{header|Kotlin}}== |
=={{header|Kotlin}}== |
||
Kotlin already has a ` |
Kotlin already has a `sortedBy` function that can sort using a key extractor directly, so there is no need to decorate/undecorate. Nevertheless, the code example below shows how to decorate, sort and undecorate. |
||
<syntaxhighlight lang="kotlin"> |
<syntaxhighlight lang="kotlin"> |
||
fun main() { |
fun main() { |