How can I retrieve all of the maximum values from a list?
问题 I have a class called Employee that implements the Comparable interface. Now I have 5 Employee objects in my list, each of which has its own salary property. I want to find all of the Employee objects that have the max salary. I can get a single object using Employee employee = Collections.max(employeeList); but that only returns a single Employee , while I am trying retrieve an array or list of all of the objects with the same max value. How can I do this? 回答1: To be efficient, you should