List 排序

List 排序

class Mycomparator implements Comparator{

   public int compare(Object arg0, Object arg1) {
    Step obj0=(Step)arg0;
    Step obj1=(Step)arg1;
    if(obj0.getId()<obj1.getId()){
     return 0;
    }else{
     return 1;
    }
   }
   
  }
  Comparator comp = new Mycomparator();
  Collections.sort(historyList,comp);

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