使用stream().parallel().anyMatch判断是否匹配 匹配的话返回true
使用stream().filter 结合collect(Collectors.toList()) 过滤不满足的条件
List<Tuple<String, List<Map<String, Object>>>> result = Lists.newLinkedList();
Boolean isHandon = false;
for (Tuple<String, List<Map<String, Object>>> entry : result) {
List<Map<String, Object>> orgCodeList = entry.getTwo();
isHandon = entry.getTwo().stream().parallel().anyMatch(map -> map.containsValue("135")
|| map.containsValue("136")
|| map.containsValue("175")
|| map.containsValue("176")
|| map.containsValue("230")
|| map.containsValue("231")
|| map.containsValue("235")
|| map.containsValue("236"));
List<Map<String,Object>> opList = orgCodeList.stream().filter(map ->
StringUtils.equals(ObjectUtils.toString(map.get("op_code")), "171")
|| StringUtils.equals(ObjectUtils.toString(map.get("op_code")), "131")).collect(Collectors.toList());
orgCodeList.clear();
orgCodeList.addAll(opList);
}
说明:parallel会并行化处理,多线程处理, (串行处理是指:一个一个处理)
filter处理后需要使用collect进行接收