This change adds the Delete operation (with the same semantics as
sync.Map's Delete) to HashTrieMap.
Change-Id: If90376ff735256444538719d670ed07e9e42870b
Reviewed-on: https://go-review.googlesource.com/c/go/+/606458
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
return v, true
}
+// Delete deletes the value for a key.
+func (ht *HashTrieMap[K, V]) Delete(key K) {
+ _, _ = ht.LoadAndDelete(key)
+}
+
// CompareAndDelete deletes the entry for key if its value is equal to old.
// The value type must be comparable, otherwise this CompareAndDelete will panic.
//