code: public static <T extends SoyNode> List<T> cloneListWithNewIds(
        List<T> origNodes, IdGenerator nodeIdGen) {
  
      Preconditions.checkNotNull(origNodes);
      List<T> clones = new ArrayList<>(origNodes.size());
      for (T origNode : origNodes) {
        @SuppressWarnings("unchecked")
        T clone = (T) origNode.copy(new CopyState());
        (new GenNewIdsVisitor(nodeIdGen)).exec(clone);
        clones.add(clone);
      }
  
      return clones;
    }
docs: Clones the given list of nodes and then generates and sets new ids on all the cloned nodes (by
  default, SoyNode.copy(copyState) creates cloned nodes with the same ids as the original nodes).
  
  <p>This function will use the original Soy tree's node id generator to generate the new node
  ids for the cloned nodes. Thus, the original nodes to be cloned must be part of a full Soy
  tree. However, this does not mean that the cloned nodes will become part of the original tree
  (unless they are manually attached later). The cloned nodes will be independent subtrees with
  parents set to null.
  
  @param <T> The type of the nodes being cloned.
  @param origNodes The original nodes to be cloned. These nodes must be part of a full Soy tree,
  because the generator for the new node ids will be retrieved from the root (SoyFileSetNode)
  of the tree.
  @param nodeIdGen The ID generator used for the tree.
  @return The cloned nodes, with all new ids for their subtrees.