I have two Model classes that I am adding to ArrayList items and both of the model classes have a getDate() and I want to sort the list by date. I have been going at it for a while but can't seem to get it.
ArrayList<Object> items = new ArrayList<>();
ArrayList<LiftDate> liftDates = LiftDateHandler.get(getActivity()).getDate();
ArrayList<OneRepMax> oneRepMaxes = OneRepMaxHandler.get(getActivity()).getORM();
items.addAll(liftDates);
items.addAll(oneRepMaxes);
Both LiftDate.class and OneRepMax.class contain:
public Date getDate() {
return mDate;
}
How do I sort the ArrayList items based on the two Objects getDate()?