задача 6. Courses от Exercise: Maps, Lambda and Stream API дава само един верен отговор
Здравейте,
задачата е
Write a program, which keeps information about courses. Each course has a name and registered students.
You will receive course name and student name, until you receive the command "end". Check if such course already exists, and if not - add the course. Register the user into the course. When you do receive the command "end", print the courses with their names and total registered users, ordered by the count of registered users in descending order. For each contest print registered users ordered by name in ascending order.
Input
- Until you receive "end", the input come in the format: "{courseName} : {studentName}"
- The product data is always delimited by " : "
Output
- Print information about each course, following the format:
"{courseName}: {registeredStudents}" - Print information about each student, following the format:
"-- {studentName}"
решението ми:
Нулевите тестове минават , а накрая само един верен отговор. Не мога да разбера къде се дъни.
Благодаря, с LinkedHashMap минава.
А имаш ли идея защо се получава така? Нали при отпечатването се прави сортиране , така че не би трябвало да има значение.