shad-go/treeiter/treeiter_example_test.go
2023-10-03 20:25:41 +03:00

28 lines
399 B
Go

package treeiter_test
import (
"fmt"
"gitlab.com/manytask/itmo-go/public/treeiter"
)
func ExampleDoInOrder() {
tree := &ValuesNode[string]{
value: "root",
left: &ValuesNode[string]{
value: "left",
},
right: &ValuesNode[string]{
value: "right",
},
}
treeiter.DoInOrder(tree, func(t *ValuesNode[string]) {
fmt.Println(t.value)
})
// Output:
// left
// root
// right
}