//原先 21, 140, 54, 56, 58, 73, 22, 31, 1, 10, 4, 5, 8, 7, 2, 3
Collections.sort(nowEffectInProject,new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
if(o1 == null || o2 == null){
return -1;
}
if(o1.length() > o2.length()){
return 1;
}
if(o1.length() < o2.length()){
return -1;
}
if(o1.compareTo(o2) > 0){
return 1;
}
if(o1.compareTo(o2) < 0){
return -1;
}
if(o1.compareTo(o2) == 0){
return 0;
}
return 0;
}
});
List<String>排序
于 2022-02-28 22:35:42 首次发布