// 将集合中的某个属性单独抽取为list或setSet<Long> set = userList.stream().map(User::getId).collect(Collectors.toList());Set<Long> set = userList.stream().map(User::getId).collect(Collectors.toSet());
文章目录// 将集合中的某个属性单独抽取为list或setSet<Long> set = userList.stream().map(User::getId).collect(Collectors.toList());Set<Long> set = userList.stream().map(User::getId).collect(Collectors.toSet());// 将集合分组转Map,并指定value取哪个字段Map<Long, List<Lon