您必须完成此代码:
ArrayList<ArrayList<DriverLogDatePair>> driverLogList = new ArrayList<>();
Collections.sort( driverLogList, new Comparator<ArrayList<DriverLogDatePair>>(){
@Override public int compare(
ArrayList<DriverLogDatePair> left,
ArrayList<DriverLogDatePair> right )
{
return 0;
}});
因为第一个数组包含一个包含 Comparable 的数组。您提供的比较器适用于 DriverLogDatePair 而不是 ArrayList< DriverLogDatePair >
(......在这篇文章的评论之后......)
根据您的要求,我建议完成比较器:
int size = left.size();
int diff = size - right.size();
if( diff != 0 ) return diff;
for( int i = 0; i < size; ++i ) {
diff = left.get( i ).compareTo( right.get(i) );
if( diff != 0 ) return diff;
}
但我不知道这种比较的真正含义。这是一个语义问题,这真的是你想要的吗?