Implement sorting with Java Streams
Problem Sort a collection of objects using the Java Streams API, then extend it to multi-key ordering. Be ready to fall back to implementing a sort manually if asked.
Input / Output
- Input: a
List<T>(e.g. employees) and one or more sort keys. - Output: a new sorted list (Streams are non-mutating).
Example
- Sort employees by department ascending, then by salary descending.
asked …