对集合的操作

> 对Set集合的排序操作

Set<Long> keySet = map.keySet();

List<Long> arrayList = new ArrayList<>(keySet);

      Collections.sort(arrayList, new Comparator<Object>() {
            @Override
            public int compare(Object o1, Object o2) {
                Long time1 = (Long) o1;
                Long time2 = (Long) o2;
                if(time1 - time2 > 0){
                    return -1;
                }else{
                    return 0;
                }
            }
        });
原文地址:https://www.cnblogs.com/han-guang-xue/p/12931636.html