The 'filter().findAny().isPresent()' chain can be replaced with 'anyMatch()'

This commit is contained in:
runphp
2022-02-11 06:15:39 +00:00
committed by Gitee
parent 27d46fc0a4
commit 155eb55953

View File

@@ -44,7 +44,7 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr
public boolean matchBlacklist(String url)
{
return blacklistUrlPattern.isEmpty() ? false : blacklistUrlPattern.stream().filter(p -> p.matcher(url).find()).findAny().isPresent();
return !blacklistUrlPattern.isEmpty() && blacklistUrlPattern.stream().anyMatch(p -> p.matcher(url).find());
}
public List<String> getBlacklistUrl()