File tree 2 files changed +2
-7
lines changed
java-comparable-comparator-examples/src
2 files changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,5 @@ public static void main(String[] args) {
18
18
Collections .sort (employees );
19
19
20
20
System .out .println ("\n Employees (After Sorting) : " + employees );
21
-
22
- // This will use the same `compareTo()` method of the `Employee` class but will reverse the order
23
- Collections .sort (employees , Comparator .reverseOrder ());
24
- System .out .println ("\n Employees (After Sorting with reverseOrder)" + employees );
25
21
}
26
-
27
22
}
Original file line number Diff line number Diff line change @@ -34,6 +34,6 @@ public static void main(String[] args) {
34
34
// Chaining multiple Comparators
35
35
// Sort by Salary. If Salary is same then sort by Name
36
36
Collections .sort (employees , Comparator .comparingDouble (Employee ::getSalary ).thenComparing (Employee ::getName ));
37
- System .out .println ("\n Employees (Sorted by Salary and Id ) : " + employees );
37
+ System .out .println ("\n Employees (Sorted by Salary and Name ) : " + employees );
38
38
}
39
- }
39
+ }
You can’t perform that action at this time.
0 commit comments