keith-turner commented on code in PR #5217:
URL: https://github.com/apache/accumulo/pull/5217#discussion_r1920821972


##########
core/src/main/java/org/apache/accumulo/core/security/ColumnVisibility.java:
##########
@@ -125,6 +125,23 @@ public Node(int start, int end) {
       this.end = end;
     }
 
+    /**
+     * Creates a new node by performing a deep copy of an existing node object
+     *
+     * @param node Node object
+     * @since 2.1.4
+     */
+    public Node(Node node) {
+      List<Node> childrenNew = new ArrayList<>(node.children.size());
+      for (Node child : node.children) {
+        childrenNew.add(new Node(child));
+      }

Review Comment:
   Looked over the existing code and noticed it had some handling to avoid 
allocating empty list in the nodes. Can do that here also.
   
   ```suggestion
         List<Node> childrenNew = node.children.isEmpty() ? EMPTY : new 
ArrayList<>(node.children.size());
         for (Node child : node.children) {
           childrenNew.add(new Node(child));
         }
   ```



-- 
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-unsubscr...@accumulo.apache.org

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

Reply via email to