Browse Source

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

Merge pull request !146 from runphp/N/A
tags/v3.5.0
若依 3 years ago committed by Gitee
parent
commit
9c122a4bfe
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
  1. 2
      ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/BlackListUrlFilter.java

2
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/BlackListUrlFilter.java

@ -44,7 +44,7 @@ public class BlackListUrlFilter extends AbstractGatewayFilterFactory<BlackListUr @@ -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()

Loading…
Cancel
Save