You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use treebidimap and detect this strange behavior:
Procedure :
Create new map : t := treebidimap.NewWith(utils.IntComparator, utils.StringComparator)
Add first element : t.Put(1,1)
Add second element : t.Put(1,1)
Expected:
The panic happens when adding first element
Actual:
The panic only happens when adding second element
Tried to check [redblacktree.go] and got the following :
// Put inserts node into the tree.
// Key should adhere to the comparator's type assertion, otherwise method panics.
func (tree *Tree) Put(key interface{}, value interface{}) {
var insertedNode *Node
if tree.Root == nil {
tree.Root = &Node{Key: key, Value: value, color: red}
insertedNode = tree.Root
} else {
node := tree.Root
loop := true
for loop {
compare := tree.Comparator(key, node.Key)
There seems the Comparator is not used for first node/element, it is inserted directly to the map.
Is this case as your expected? Did I miss any information in README?
The text was updated successfully, but these errors were encountered:
@linhnt89 thank you for the detailed report. on the first glance this looks like a bug and i will investigate now what's going on. willl keep you posted... for now labeling as a bug
I'm trying to use treebidimap and detect this strange behavior:
Procedure :
t := treebidimap.NewWith(utils.IntComparator, utils.StringComparator)
t.Put(1,1)
t.Put(1,1)
Expected:
Actual:
Tried to check [redblacktree.go] and got the following :
There seems the Comparator is not used for first node/element, it is inserted directly to the map.
Is this case as your expected? Did I miss any information in README?
The text was updated successfully, but these errors were encountered: