美文网首页
ArrayList排序

ArrayList排序

作者: 浮生若梦梦不归 | 来源:发表于2017-05-16 15:28 被阅读0次

    Collections.sort(gradeclassnameList, newSortByAge());

    for(GradeClassBean.ResultBean.ClassListBean student :gradeclassnameList) {

    System.out.println(student.getGradeId());

    }

    classSortByAgeimplementsComparator {

    public intcompare(Object o1,Object o2) {

    GradeClassBean.ResultBean.ClassListBean s1 = (GradeClassBean.ResultBean.ClassListBean) o1;

    GradeClassBean.ResultBean.ClassListBean s2 = (GradeClassBean.ResultBean.ClassListBean) o2;

    returnFloat.compare(Integer.parseInt(s1.getGradeId()),Integer.parseInt(s2.getGradeId()));

    }

    }

    相关文章

      网友评论

          本文标题:ArrayList排序

          本文链接:https://www.haomeiwen.com/subject/xpulxxtx.html