public static PlanNode replaceChildren(PlanNode node, List<PlanNode> children)
    {
        for (int i = 0; i < node.getSources().size(); i++) {
            if (children.get(i) != node.getSources().get(i)) {
                return node.replaceChildren(children);
            }
        }
        return node;
    }
public static PlanNode replaceChildren ( PlanNode node , List < PlanNode > children ) { for ( int i = 0 ; i < node . getSources ( ) . size ( ) ; i ++ ) { if ( children . get ( i ) != node . getSources ( ) . get ( i ) ) { return node . replaceChildren ( children ) ; } } return node ; }
Return an identical copy of the given node with its children replaced