As we are using Date property of ArrayList, we can use compareTo() method, because Date implements comparable.
public class CustomComparator implements Comparator<MyObject> {
@Override
public int compare(MyObject o1, MyObject o2) {
return o1.getStartDate().compareTo(o2.getStartDate());
}
}
comapreTo() returns int value.
Collections.sort(Database.arrayList, new CustomComparator());