You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/09/28 06:52:40 UTC

[GitHub] [camel] lburgazzoli commented on a change in pull request #4307: CAMEL-15585 - Camel Core health small refactor.

lburgazzoli commented on a change in pull request #4307:
URL: https://github.com/apache/camel/pull/4307#discussion_r495723178



##########
File path: core/camel-health/src/main/java/org/apache/camel/impl/health/HealthCheckRegistryRepository.java
##########
@@ -109,14 +109,10 @@ private HealthCheck toHealthCheck(HealthCheck hc) {
     }
 
     private HealthCheckConfiguration matchConfiguration(String id) {
-        if (configurations != null) {
-            for (String key : configurations.keySet()) {
-                if (PatternHelper.matchPattern(id, key)) {
-                    return configurations.get(key);
-                }
-            }
-        }
-        return fallbackConfiguration;
-    }
 
+        return configurations.values().stream()
+                .filter(s -> PatternHelper.matchPattern(id, s.getParent()))
+                .findAny()
+                .orElseGet(() -> fallbackConfiguration);

Review comment:
       I think `orElseGet(Supplier)` can be replaced by `orElse(fallbackConfiguration)` since the `fallbackConfiguration` does not need to be computed




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org