使用Collections给集合排序
作者:互联网
Collections.sort(ydShips, new Comparator<YdShip>() { @Override public int compare(YdShip o1, YdShip o2) { if(o1.getNumber()> o2.getNumber()){ //number是用来排序的列 return 1; }else if(o1.getNumber()==o2.getNumber()){ return 0; } return -1; } });
标签:return,getNumber,YdShip,Collections,集合,排序,o2,o1 来源: https://www.cnblogs.com/HQ0422/p/11439300.html