protected void addChildren(Node... children) { // most used. short circuit addChildren(int), which hits reindex children and array copy for (Node child : children) { reparentChild(child); childNodes.add(child); child.setSiblingIndex(childNodes.size() - 1); } }
protected void addChildren(int index, Node... children) { Validate.noNullElements(children); for (int i = children.length - 1; i >= 0; i--) { Node in = children[i]; reparentChild(in); childNodes.add(index, in); } reindexChildren(); }