您还可以使用自定义比较器:
public class CategoriesComparator implements Comparator<Category> { @Override public int compare(Category category1, Category category2) { return category1.getSomeProperty().compareTo(category2.getSomeProperty()); }}
当您要比较时,请致电:
Collections.sort(yourListCategories, new CategoriesComparator());
希望能帮助到你!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)