java8并行流操作

1、多参数情况

 BiConsumer 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())
                ;


你可能感兴趣的:(JAVA)