1、java.stream流使用
List<TRoleUser> roleUserList = new ArrayList<>();
Map<String, List<String>> projectId_roleIds_map = roleUserList.stream().collect(Collectors.groupingBy(IRoleUser::getProjectId, Collectors.mapping(TRoleUser::getRoleId, Collectors.toList())));
Map<String, List<TRoleUser>> projectId_roles_map = roleUserList.stream().collect(Collectors.groupingBy(IRoleUser::getProjectId, Collectors.toList()));
List<String> roleIds = roleUserList.stream().map(TRoleUser::getRoleId).collect(Collectors.toList());
List<ProjectInfo> projectInfoList = new ArrayList<>();
Map<String, ProjectInfo> id_info_map = projectInfoList.stream().collect(Collectors.toMap(ProjectInfo::getId, Function.identity(), (oldKey, newKey) -> newKey));
Map<String, ProjectInfo> id_info_map = projectInfoList.stream().collect(Collectors.toMap(ProjectInfo::getId, Function.identity(), (oldKey, newKey) -> newKey, TreeMap::new));
List<ProjectInfo> infos = projectInfoList.stream().filter(projectInfo -> "ENABLE".equals(projectInfo.getStatus())).collect(Collectors.toList());