嵌套List排序,java8 Stream流排序

如图类型数据格式,现在要进行排序。根据java8的写法可为:

List<B> dtoList=list<A>.getData();

List<B> bList=dtoList.stream()
                    .sorted(Comparator.comparing(o -> o.getListc().get(0).getsomeA()))
                    .collect(Collectors.toList());

list<A>.setListB(bList);


java8获取list中的某个字段
List<String> tagList = tagDTOList.stream()
.map(TeacherAllTagDTO::getZhName)
.collect(Collectors.toList());

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2021-08-08
  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-03-02
相关资源
相似解决方案