I have a record object
public Record{
double simiADD;
}
I Have a List of Record objects and I want to Sort on simiADD. Record with le
I assume that you meant that you don't want to implement "Comparable" interface in your class. Use Comparator and Collection's sort static method:
import java.util.*;
public class EmpSort {
static final Comparator SENIORITY_ORDER =
new Comparator() {
public int compare(Employee e1, Employee e2) {
return e2.hireDate().compareTo(e1.hireDate());
}
};
// Employee database
static final Collection employees = ... ;
public static void main(String[] args) {
Liste = new ArrayList(employees);
Collections.sort(e, SENIORITY_ORDER);
System.out.println(e);
}
}