List集合排序

一:工具类


二:应用

按设备在线状态排序

List<Device> deviceList = deviceAction.listDevices(qc);
SortListUtil<Device> sortList =  new SortListUtil<Device>();  
sortList.Sort(deviceList, "getIsConnect", "desc");  
for(Device s: deviceList){  
      System.out.println(s.getRegistrationId()+","+s.getIsConnect());  
   }  


输出结果
2CFBEB9EE6346B38A2AC0E7D4F6E105F,1
48D586E92420509738729E2A1042E73E,1
424FE699FF11FC2FB900D32FFF61F8DA,0
86BDC7A3BB7DA035D378C4DFD4CD627A,0
E72539F86A9D3C36E58BE9769E902CB3,0
0D13EB8069108A75D1A5D34F0D8B2027,0
6BB272D953328025F53A84913A9E070C,0


你可能感兴趣的:(集合排序)