/×× ×JAVA LIST 排序方法 × ××/ private class ComparatorUser implements Comparator { public int compare(Object arg0, Object arg1) { Object pd1 = (Object) arg0; Object pd2 = (Object) arg1; int flag = String.valueOf(获取pd2中依据排序字段).compareTo(String.valueOf(获取pd1中依据排序字段)); return flag; } }
//调用方法 Collections.sort(sortList, new ComparatorUser());//调用