--多线程处理 CompletableFuture<Object> future2 = ThreadUtil.supplyAsyncWithContext(() -> { // 进行中 状态的活动 getAndUpdateCurrentNextAccounts(currentNextAccountList, userId, roleMap, userCNMap); return null; }); checkAndUpdateToNullAccount(toNullList); CompletableFuture allQuery = CompletableFuture.allOf(future1, future2); allQuery.join(); ProjectInstance projectInstance = projectInstanceService.getById(projectId); recursionHandler(projectInstance, projectActivityVOS, userCNMap); --多线程supplyAsync CompletableFuture<Object> baseFormFuture = CompletableFuture.supplyAsync(() -> { ApplicationContextHelper.setApplicationContextUser(); // 查询基本信息 return mouldAcceptancePreviewService.getBaseCard(queryVo); }, ThreadPoolFactory.EXECUTOR); --CompletableFuture.supplyAsync取值 List<CompletableFuture<Object>> instancesFutureList = instanceVOS.stream() .map(item -> CompletableFuture.supplyAsync(() -> { ApplicationContextHelper.setRequestContextHolder(currentUser); queryBaseForm(item.getInstanceId(), supplierCode, pId, instanceSet); return null; }, ThreadPoolFactory.EXECUTOR)) .collect(Collectors.toList()); instancesFutureList.stream().map(CompletableFuture::join).collect(Collectors.toList()); --list 取字段值 List<String>delIds=drawingList.stream().map(DeleteObjectInput::getId).collect(Collectors.toList()); -- list to map Map<String, PartVO> partMap = parts.stream().collect(Collectors.toMap(PartVO::getNumber, item -> item, (k1, k2) -> k2)); -- mybatisplus取值 List<StringvalueData>stringValueDatas= stringvalueDataService.list(Wrappers.<StringvalueData>lambdaQuery() .in(StringvalueData::getInstanceTypeId, problemInstances.stream().map(ProblemInstance::getId).collect(Collectors.toList())) .in(StringvalueData::getAttributeName,Arrays.asList(ProblemConstants.NEXT_PROCCESSOR))); -- mybatisplus取值 List<SupplierTask>supplierTasks=supplierTaskService.list( Wrappers.<SupplierTask>lambdaQuery().eq(SupplierTask::getInstanceCode,pboNumber) .eq(SupplierTask::getSupplierCode,supplierCode));
标签:map,stream,Collectors,--,jkd8,用法,collect,CompletableFuture From: https://www.cnblogs.com/zeenzhou/p/17600585.html