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

Merge pull request !146 from runphp/N/A
This commit is contained in:
若依
2022-02-12 06:03:20 +00:00
committed by Gitee

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