0
我有一個列表結果列表,並且我想在對象[]的內容之後對列表進行排序。所以我想在帳戶'row [11]'後面排序,然後是'row'[1]'。我如何使用Groovy進行第二類?對第二個標準之後的排序列表進行排序
Object[] row = (Object[]) resultList.get(i);
String account = row[11];
String vehicle = row[1];
例
Account Vehicle
HKB 300 - PB
HKV 400 - PDAAA
HMN 200 - PBC200
HZA 155 - PCL
HZA 160 - PGA100
HZAB 165 - PGA100
HZAC 170 - PGA100
代碼
int execute(List <Object[]> resultList) {
Object[] row = null;
resultList = resultList.sort{ a,b -> a[11] <=> b[11]};
//Then here I want to sort the sorted resultList after the vehicle also second group.
for (int i=resultList.size()-1; i >= 0; i--) {
row = (Object[]) resultList.get(i);
String account = row[11];
String vehicle = row[1];
}
return 1;
}
你能想出一些示例輸入和預期輸出嗎? –