// rowList为待排序的集合 String reg = "[^\\d]"; Collections.sort(rowList, (o1, o2) -> { int first = Integer.parseInt(o1.getHoleNo().replaceAll(reg, ""))+o1.getHoleNo().getBytes()[0]*100; int second = Integer.parseInt(o2.getHoleNo().replaceAll(reg, ""))+o2.getHoleNo().getBytes()[0]*100; return first.compareTo(second); }); return rowList;
排序效果:
编辑