将map按照值排序

值里面存放的是一个对象需要根据id排序 将相同的人放在一起

 List<Map.Entry<String, CorrectRate>> list =
                new LinkedList<Map.Entry<String, CorrectRate>>(correctRateOm.entrySet());
        Collections.sort(list, new Comparator<Map.Entry<String, CorrectRate>>() {
            public int compare(Map.Entry<String, CorrectRate> o1, Map.Entry<String, CorrectRate> o2) {
                return (o1.getValue().getStudentId()).compareTo(o2.getValue().getStudentId());
            }
        });

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×