1、多参数情况
BiConsumer<AliGameMapping, CallerSyncRule> cc = (gameApp, r) -> { WdjData data = WdjDataService.getEntityInfo(gameApp,r); if(data!=null){ list.add(data); } }; gameMapList.parallelStream() .forEach(a-> cc.accept(a, rule) ) ;
2、单个参数情况
list = gameMapList.parallelStream() .filter(app -> app!=null) .peek(app -> app.setRule(rule)) .map(WdjDataService::getEntityInfo) .collect(Collectors.toList()) ;