refactor and fix duplicate notification

This commit is contained in:
yusing
2024-12-01 11:12:25 +08:00
parent d1cb7a5ce4
commit 58cfba7695
3 changed files with 21 additions and 22 deletions

View File

@@ -22,6 +22,10 @@ func (set Set[T]) Remove(v T) {
set.m.Delete(v)
}
func (set Set[T]) Clear() {
set.m.Clear()
}
func (set Set[T]) Contains(v T) bool {
_, ok := set.m.Load(v)
return ok