java.util.Collections.sort对List进行排序

List<userDO> list = new ArrayList<userDO>();
java.util.Collections.sort(list, new Comparator<userDO>(){
          @Override
          public int compare(userDO o1, userDO o2) {
             return o2.getId().compareTo(o1.getId());
          }});

你可能感兴趣的:(java)