Sunday, 18 August 2013

how to max value objects from a list in java

how to max value objects from a list in java

i have a class called employee where it implements comparable interface.
now i have 5 employee objects in my list,where some objects may have
salary with the same max value.i wanted to get all those objects that have
same max value.
i can get a single object using
Employee employee = Collections.max(employeeList);
but this is not my case,i want an array or list of objects with same max
value.what is the best logic that fits the scenario?any suggestions?

No comments:

Post a Comment