map<T1 extends Object, NewNode extends GraphNode<T1> > method
Graph<T1, NewNode>
map<T1 extends Object, NewNode extends GraphNode<T1> >(
- NewNode createNode(
- T
override
Map every node in the graph to an new node type. It may be used for
converting from one specialized GraphNode implementation to another, or
for converting each GraphNode value from type T
to type NewT
for
example.
Implementation
@override
Graph<T1, NewNode> map<T1 extends Object, NewNode extends GraphNode<T1>>(
NewNode Function(T) createNode,
) {
final visited = <Node, NewNode>{};
final NewNode newRootNode =
_createOrGetMappedNode(_root, createNode, visited);
return RootGraph<T1, NewNode>(newRootNode);
}