replaceNodes<K> static method
Applies a transformation operator to all nodes in a tree.
Parameters:
nodes(List<TreeNode<K>>, required): Tree nodes.operator(TreeNodeUnaryOperator<K>, required): Transformation function.
Returns: List<TreeNode<K>> — transformed tree.
Implementation
static List<TreeNode<K>> replaceNodes<K>(
List<TreeNode<K>> nodes, TreeNodeUnaryOperator<K> operator) {
return _replaceNodes(nodes, operator) ?? nodes;
}