Skip to content

Commit

Permalink
Merge pull request #167 from jetbrains-academy/stephen-hero-patch-23
Browse files Browse the repository at this point in the history
Update task.md
  • Loading branch information
nbirillo authored Dec 25, 2023
2 parents a43d396 + ca93eb4 commit b10a468
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions wordsGeneratorServer/wordsGeneratorServerWordService/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ You can also use the `isEmpty` function with strings, not only with lists:
```
</div>

<div class="hint" title="Click me to learn about the aggregation built-in functions">
<div class="hint" title="Click me to learn about the built-in aggregation functions">

Kotlin has a lot of built-in functions for aggregation; consider several of those that can help you solve this task.
You can use [`groupingBy`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/grouping-by.html) to group the word by its letters
and next [`eachCount`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/each-count.html) to count the occurrences of each letter:
and then use [`eachCount`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/each-count.html) to count the occurrences of each letter:

```kotlin
fun main() {
Expand All @@ -77,7 +77,7 @@ You need to enclose the predicate in curly brackets:

<div class="hint" title="Click me to learn about the putIfAbsent built-in function">

If you work with a `map`, you can use the built-in `putIfAbsent` function to add a new value if it is absent in the `map`:
When working with a `map`, you can use the built-in `putIfAbsent` function to add a new value if it is not present in the `map`:
```kotlin
val myMap = mutableMapOf<Int, String>()
if (1 !in myMap.keys) {
Expand All @@ -93,8 +93,8 @@ It is the **same** as:

<div class="hint" title="Click me to learn about `contains` and `in`">

In Kotlin, you can use [operators](https://kotlinlang.org/docs/java-interop.html#operators) insted several functions to make code shorter.
For example, instead of the `contains` function, you can use the `in` operator to check if the collection contains some element:
In Kotlin, you can use [operators](https://kotlinlang.org/docs/java-interop.html#operators) insted of certain functions to make code shorter.
For example, instead of using the `contains` function, you can use the `in` operator to check if a collection contains a specific element:

```kotlin
val numbers = listOf(1, 2, 3, 4)
Expand Down

0 comments on commit b10a468

Please sign in to comment.