I have a list List<Object[]>
.
The Object[] has the following objects:
- Date "dd.MM.yyyy"
- String
- Date "HH:mm".
I am able to sort the list after the dd.MM.yyyy
and then after the String
. Now I want to sort it after the time too also the result should be sorted "dd.MM.yyyy", sorted "String", sorted "time".
Collections.sort(resultList, new Comparator<Object[]>() {
public int compare(Object[] o1, Object[] o2) {
int dateComparison = (( o2[0]).compareTo(o1[0]));
return dateComparison == 0 ? ( o1[1]).compareTo( o2[1]) : dateComparison;
}
});
How can I get it to work?