Hi, I have one question
I have to count names and surnames -> name is value of HashMap and surname is key of HashMap so they (surnames) have never will be the same because the key is always different. (I readed this on course )
I'm not understand this task, Can somebody explain me why is it like this written in task ? (I mean this why i have to count surnames )
HashMap
Rozwiązane
Komentarze (2)
- Popularne
- Najnowsze
- Najstarsze
Musisz się zalogować, aby dodać komentarz
Gellert Varga
9 października 2021, 21:48rozwiązanie
This Map<String, String> contains (last name, first name) pairs.
"The getSameFirstNameCount() method must return the number of people whose first name is the same as the name parameter."
- You can count it. The result can be 0, or 1, or 2, or 3, etc.
"The getSameLastNameCount() method must return the number of people whose last name is the same as the lastName parameter."
- It can be 0 or 1, and nothing else.
If the map contains the given lastName (the given key): then this value is 1, but it can never be more than 1.
+2
Mateusz
10 października 2021, 09:33
Thank's :)
0