rikkarth commented on code in PR #412:
URL:
https://github.com/apache/commons-configuration/pull/412#discussion_r1589697146
##########
src/main/java/org/apache/commons/configuration2/ImmutableConfiguration.java:
##########
@@ -62,6 +62,20 @@ public interface ImmutableConfiguration {
*/
boolean containsKey(String key);
+ /**
+ * Returns true if this configuration contains one or more matches to this
value. This operation stops at first
+ * match but may be more expensive than the {@link #containsKey
containsKey} method.
+ *
+ * @param value value whose presence in this configuration is to be tested
+ * @return {@code true} if this configuration maps one or more keys to the
specified value
+ * @throws NullPointerException if the value is {@code null}
+ * @throws UnsupportedOperationException if this method is not supported
by the implementing class.
+ */
+ default boolean containsValue(String value) {
Review Comment:
Ok, so I gave an actual default implementation to `containsValue` in
`ImmutableConfiguration` and tested it with that DummyClass that I didn't want
to create to test it and see if it worked.
And it worked.



```java
/**
* Tests whether this configuration contains one or more matches to this
value. This operation stops at first
* match but may be more expensive than the {@link #containsKey
containsKey} method.
*
* @param value value whose presence in this configuration is to be
tested
* @return {@code true} if this configuration maps one or more keys to
the specified value
* @throws NullPointerException if the value is {@code null}
* @since 2.0
*/
default boolean containsValue(final String value) {
Objects.requireNonNull(value, "Parameter \"value\" cannot be null");
final Iterator<String> keys = getKeys();
while (keys.hasNext()) {
if (value.equals(getProperty(keys.next()))) {
return true;
}
}
return false;
}
```
--
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]