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; } });
2024-03-16 18:05:34
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; } });
下一篇:02 Lambda表达式