You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/10/15 12:57:23 UTC

[GitHub] [accumulo] cshannon commented on a diff in pull request #3025: Use NamespaceOperations.modifyProperties() in more places

cshannon commented on code in PR #3025:
URL: https://github.com/apache/accumulo/pull/3025#discussion_r996303180


##########
shell/src/main/java/org/apache/accumulo/shell/commands/CreateNamespaceCommand.java:
##########
@@ -62,12 +63,11 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s
       }
     }
     if (configuration != null) {
-      for (Entry<String,String> entry : configuration.entrySet()) {
-        if (Property.isValidTablePropertyKey(entry.getKey())) {
-          shellState.getAccumuloClient().namespaceOperations().setProperty(namespace,
-              entry.getKey(), entry.getValue());
-        }
-      }
+      var propsToAdd = configuration.entrySet().stream()
+          .filter(entry -> Property.isValidTablePropertyKey(entry.getKey()))
+          .collect(Collectors.toMap(Entry::getKey, Entry::getValue));
+      shellState.getAccumuloClient().namespaceOperations().modifyProperties(namespace,
+          properties -> properties.putAll(propsToAdd));

Review Comment:
   ```suggestion
         final Map<String,String> config = configuration;
         shellState.getAccumuloClient().namespaceOperations().modifyProperties(namespace,
             properties -> config.entrySet().stream()
                 .filter(entry -> Property.isValidTablePropertyKey(entry.getKey()))
                 .forEach(entry -> properties.put(entry.getKey(), entry.getValue())));
   ```
   Basically the same suggestion as in #2965



-- 
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: notifications-unsubscribe@accumulo.apache.org

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