Challenge: Sorting Employees
Uppgift
Swipe to start coding
Implement a Comparator to sort the list of employees based on the specified criteria.
- Sort the employees by years of experience in ascending order, and then apply the
reversed()method to make the order descending. - If the years of experience are the same, sort the employees with the same experience by
salaryin descending order. - If both experience and salary are the same, sort by
namein alphabetical order. - Use the created comparator as an argument for the
sort()method to sort the employee list. - Print the sorted list of employees.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 10
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Fantastiskt!
Completion betyg förbättrat till 2.33
Challenge: Sorting Employees
Svep för att visa menyn
Uppgift
Swipe to start coding
Implement a Comparator to sort the list of employees based on the specified criteria.
- Sort the employees by years of experience in ascending order, and then apply the
reversed()method to make the order descending. - If the years of experience are the same, sort the employees with the same experience by
salaryin descending order. - If both experience and salary are the same, sort by
namein alphabetical order. - Use the created comparator as an argument for the
sort()method to sort the employee list. - Print the sorted list of employees.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 10
single