rikkarth commented on code in PR #412:
URL: 
https://github.com/apache/commons-configuration/pull/412#discussion_r1586346455


##########
src/main/java/org/apache/commons/configuration2/AbstractHierarchicalConfiguration.java:
##########
@@ -455,6 +455,26 @@ protected boolean containsKeyInternal(final String key) {
         return getPropertyInternal(key) != null;
     }
 
+    @Override
+    protected boolean containsValueInternal(final String value) {
+        return contains(getKeys(), value);
+    }
+
+    private boolean contains(Iterator<String> keys, final String value) {
+        if (keys.hasNext()) {
+            String nextKey = keys.next();
+            Object valueFromKey = getProperty(nextKey);
+
+            if (valueFromKey.equals(value)) {
+                return true;
+            }
+
+            contains(keys, value);
+        }
+
+        return false;
+    }
+

Review Comment:
   That was my initial idea (use the while). The functional part of me decided 
against KISS.
   
   I will revert to a while and no need for suplier since method (now updated 
in last commit) is only called from one place.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to