feat: add drop key functionality #6
@@ -26,11 +26,12 @@ func (b bucket[K, V]) get(key K) (value V, found bool) {
|
||||
return slot.value, slot.occupied && b.compare(slot.key, key)
|
||||
}
|
||||
|
||||
func (b bucket[K, V]) drop(key K) (occupied bool) {
|
||||
func (b *bucket[K, V]) drop(key K) (occupied bool) {
|
||||
slot := &b.slots[b.location(key)]
|
||||
|
||||
if slot.occupied && b.compare(slot.key, key) {
|
||||
slot.occupied = false
|
||||
b.size--
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user