diff --git a/duckShopServer/duckShopServerPartition/task.md b/duckShopServer/duckShopServerPartition/task.md index 680a5cf..21e3e4e 100644 --- a/duckShopServer/duckShopServerPartition/task.md +++ b/duckShopServer/duckShopServerPartition/task.md @@ -1,16 +1,16 @@ -In this task you need to implement a function to be able to -divide ducks in the Duck Shop into two categories - with any Kotlin stuff and without it - and reorder them according to this condition. +In this task, you need to implement a function to be able to +divide ducks in the Duck Shop into two categories — those with some Kotlin-related stuff and those without it — and reorder them according to this condition. ### Task Implement the `divideDucksIntoKotlinAndNonKotlin` function from the `GameActionFunctionsService` class in the `org.jetbrains.kotlin.course.duck.shop.functions.action` package. -This function should divide ducks into two groups - with any Kotlin attribute (the field `hasKotlinAttribute` is `true`) and without - and returns these two collections. +This function should divide ducks into two groups — those with some Kotlin attribute (the field `hasKotlinAttribute` is `true`) and those without it — and return these two collections. -We have only one function, since the function `fun Collection.divideDucksIntoKotlinAndNonKotlin()` works for both collections - for `List` and for `Set`. +We have only one function, since the function `fun Collection.divideDucksIntoKotlinAndNonKotlin()` works for both collections — for `List` and for `Set`. The map collection does not have this function. -After implementing this task the `Partition` button in `list` and `set` modes becomes alive: +After implementing this task, the `Partition` button in `list` and `set` modes becomes alive: ![Current state](../../utils/src/main/resources/images/duck/shop/states/state_7.gif) @@ -22,7 +22,7 @@ If you have any difficulties, **hints will help you solve this task**.
-You can do it in several ways, but the easiest one is to use the [`partition`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/partition.html) built-in function. +You can do it in several ways, but the easiest one is to use the built-in [`partition`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/partition.html) function. It accepts a predicate (condition) to divide a collection into two parts according to this condition: ```kotlin