Przeglądaj źródła

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

runphp 4 lat temu
rodzic
commit
155eb55953

+ 1 - 1
ruoyi-gateway/src/main/java/com/ruoyi/gateway/filter/BlackListUrlFilter.java

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