I have an ArrayList of ArrayList of Bean and I need to sort this ArrayList according to the date variable in Bean.
ArrayList<ArrayList<DriverLogDatePair>> driverLogList
And DriverLogDatePair bean have a variable DateTime date, it also has a compareTo method.
public int compareTo(DriverLogDatePair o) {
return date.compareTo(o.date);
}
But I am not able to sort driverLogList.
You have to complete this code:
Because the first array contains an array which contains a Comparable.
The comparator you provide is for DriverLogDatePair not for ArrayList< DriverLogDatePair >
(… After comments of this post… )
At your request, to complete the comparator I suggest:
But I have no idea of the true meaning of this comparison.
It’s a semantic problem, is this really what you want?