使用stream流的anyMatch
判断的条件里,任意一个元素成功,返回true
上代码
List<SectorInfo> sectorsInfo = scanResultParser.apply(scanResult);
return sectorsInfo.stream()
.map(sectorInfo -> badSectorCountParser.apply(sectorInfo.getValue()))
.anyMatch(checkRuleDefinition::match);
类比代码
for (Long count:List<Long> counts){
if (checkRuleDefinition.match(count)){
return true;
}
}
return false