keith-turner commented on a change in pull request #902: fixes #894 merge 
SimpleConfiguration Objects
URL: https://github.com/apache/fluo/pull/902#discussion_r132267259
 
 

 ##########
 File path: 
modules/api/src/main/java/org/apache/fluo/api/config/SimpleConfiguration.java
 ##########
 @@ -250,6 +250,43 @@ public SimpleConfiguration subset(String prefix) {
     return new SimpleConfiguration(internalConfig.subset(prefix));
   }
 
+  /**
+   * @param fallback SimpleConfiguration to join together
+   * @return a new simple configuration that contains all of the current 
properties from this plus
+   *         the properties from fallback that are not present in this.
+   * 
+   * @since 1.2.0
+   */
+  public SimpleConfiguration orElse(SimpleConfiguration fallback) {
+    for (Map.Entry<String, String> entry : fallback.toMap().entrySet()) {
 
 Review comment:
   This implementation modifies this, but the javadoc says returns a new.   I 
think it I would prefer returning a copy.  May be  able to do 
`SimpleConfiguration copy = new SimpleConfiguration(this)`  and then use `copy` 
instead of `this` in method.
   
   Would be nice to have a test that verifies following :
   
   ```java
     sc1 = ...
     sc2 = ...
     sc3 = sc1.orElse(sc2)
     //set something on sc1 and sc2
     // verify that sc3 did not change
   ```
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to