33The package ` jetbrains.kotlin.course.alias.team ` already has a regular class ` TeamService ` .
44It is responsible for the game logic for the teams. In this task, you need to implement several things to make the game alive:
55
6- - add a property ` identifierFactory ` with the type ` IdentifierFactory ` to generate identifiers for each team.
6+ - Add a property ` identifierFactory ` with the type ` IdentifierFactory ` to generate identifiers for each team.
77 Don't forget to add the default value for it (just create a new instance of the ` IdentifierFactory ` class).
8- - add a companion object to the ` TeamService ` class and declare the ` teamsStorage ` variable to store all previous teams.
8+ - Add a companion object to the ` TeamService ` class and declare the ` teamsStorage ` variable to store all previous teams.
99 The type of the storage should be ` MutableMap ` , which maps ` Identifier ` to ` Team ` . Don't forget to init it via an empty map.
10- - implement the ` generateTeamsForOneRound ` method.
10+ - Implement the ` generateTeamsForOneRound ` method.
1111 The method must generate a list of teams and also store all of them into the ` teamsStorage ` map.
12- To create new teams you need to use ` identifierFactory ` from the ` TeamService ` class to generate a new id.
12+ To create new teams, you need to use ` identifierFactory ` from the ` TeamService ` class to generate a new id.
1313 We need to create this method to save game results for the leaderboard.
1414
1515If you have any difficulties, ** hints will help you solve this task** .
@@ -49,7 +49,7 @@ To use `Identifier` and `IdentifierFactory`, you need to import it at the top of
4949
5050<div class =" hint " title =" Create IdentifierFactory class " >
5151
52- Since ` IdentifierFactory ` class has the default value for the ` counter ` property,
52+ Since the ` IdentifierFactory ` class has the default value for the ` counter ` property,
5353you don't need to set it in the constructor:
5454
5555 ``` kotlin
@@ -67,7 +67,7 @@ As we mentioned in the first module, you can generate a new list with `N` elemen
6767
6868<div class =" hint " title =" putIfAbsent built-in function " >
6969
70- If you work with a ` map ` , you can use the ` putIfAbsent ` built-in function to insert a new value if it is absent in the ` map ` :
70+ If you work with a ` map ` , you can use the built-in ` putIfAbsent ` function to insert a new value if it is absent in the ` map ` :
7171 ``` kotlin
7272 val myMap = mutableMapOf<Int , String >()
7373 if (1 !in myMap.keys) {
@@ -84,8 +84,8 @@ It is the same as:
8484<div class =" hint " title =" forEach built-in function " >
8585
8686If you need to handle each element in a collection, for example, in a list or in a map,
87- you can use the ` forEach ` built-in function instead of the ` for ` loop.
88- In this case, you need to write the action inside curly brackets:
87+ you can use the built-in ` forEach ` function instead of the ` for ` loop.
88+ In such a case, you need to write the action inside curly brackets:
8989 ``` kotlin
9090 val teams = List (N ) { Team (.. .) }
9191 for (team in teams) {
0 commit comments