List<QuestionChooseVO> voList = Lists.newArrayList();
......
在voList中插入一系列QuestionChooseVO对象
1、 voList.sort((QuestionChooseVO h1, QuestionChooseVO h2) -> h1.getOrderNum().compareTo(h2.getOrderNum()));
2、
List integers = Arrays.asList(1, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 0);
倒序:
List collect = integers.stream().sorted(Comparator.comparing(Integer::intValue).reversed()).collect(Collectors.toList());
3、 List collect2 = integers.stream().sorted((p1, p2) ->p2-p1).collect(Collectors.toList());
4、List collect1 = integers.stream().sorted((p1, p2) -> p2.compareTo(p1)).collect(Collectors.toList());
剩余几个常用:
1、List collect3 = list.stream().map(Student::getId).collect(Collectors.toList());
2、 Map<Long, Student> collect4 = list.stream().collect(Collectors.toMap(Student::getId, t1 -> t1, (k1, k2) -> k1));
3、 Map<Long, List> collect5 = list.stream().collect(Collectors.groupingBy(Student::getId));
4、List schoolClassesVos = reportService.getClassListByLessonId(lessonId);
List collect6 = list.stream().filter(st -> st.getId() >= 2l).collect(Collectors.toList());