Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Challenge: Sorting Employees | Fundamentals and Functional Capabilities of Stream API
Stream API
course content

Kursinhalt

Stream API

Stream API

1. Fundamentals and Functional Capabilities of Stream API
4. Practical Applications of Stream API

book
Challenge: Sorting Employees

Aufgabe

Swipe to start coding

Implement a Comparator to sort the list of employees based on the specified criteria.

  1. Sort the employees by years of experience in ascending order, and then apply the reversed() method to make the order descending.
  2. If the years of experience are the same, sort the employees with the same experience by salary in descending order.
  3. If both experience and salary are the same, sort by name in alphabetical order.
  4. Use the created comparator as an argument for the sort() method to sort the employee list.
  5. Print the sorted list of employees.

Lösung

java

solution

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 10
toggle bottom row

book
Challenge: Sorting Employees

Aufgabe

Swipe to start coding

Implement a Comparator to sort the list of employees based on the specified criteria.

  1. Sort the employees by years of experience in ascending order, and then apply the reversed() method to make the order descending.
  2. If the years of experience are the same, sort the employees with the same experience by salary in descending order.
  3. If both experience and salary are the same, sort by name in alphabetical order.
  4. Use the created comparator as an argument for the sort() method to sort the employee list.
  5. Print the sorted list of employees.

Lösung

java

solution

Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 1. Kapitel 10
Switch to desktopWechseln Sie zum Desktop, um in der realen Welt zu übenFahren Sie dort fort, wo Sie sind, indem Sie eine der folgenden Optionen verwenden
We're sorry to hear that something went wrong. What happened?
some-alt