alphadose / haxmap

Fastest and most memory efficient golang concurrent hashmap

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How Do I actually delete a key?

baagod opened this issue · comments

mep := haxmap.New[int, string]()
    
mep.Set(1, "one")
println(mep.Len()) // 1

mep.Del(1) // delegate key 1
println(mep.Len()) // 0

// Still can traverse the key/value pair ?
mep.ForEach(func(key int, value string) bool {
    fmt.Printf("Key -> %d | Value -> %s\n", key, value)
    return true
})

// Print: Key -> 1 | Value -> one

I mean, I have deleted key 1, mep.len() is already 0, why ForEach still iterates over the deleted key-value pair? How to actually remove them from mep?

@baa-god fixed with f3e3c3f