java stream group by 对结果 value 进行二次 map 示例

var result = societyMemberService.list(new LambdaQueryWrapper<SocietyMember>()
                .eq(SocietyMember::getSocietyId, societies.stream().map(x -> x.getId()))
                .in(SocietyMember::getStudentUuid, students))
        .stream().collect(Collectors.groupingBy(x -> x.getStudentUuid(), Collectors.mapping(x -> x.getSocietyId(), Collectors.toList())));

 

posted on 2022-07-20 11:41  空明流光  阅读(1655)  评论(0编辑  收藏  举报

导航