Collections集合(对象集合)的排序

需要用自己写的comparator

Comparator<AQIRankCity> comparator = new Comparator<AQIRankCity>() {
                public int compare(AQIRankCity o1, AQIRankCity o2) {
                    return o1.getRank() > o2.getRank() ? 1 : -1;
                }
            };

 

posted on 2015-06-19 16:09  dobestself_994395  阅读(112)  评论(0编辑  收藏  举报