style: no "this" or "self" as receiver

This commit is contained in:
2025-12-26 00:00:10 -05:00
parent e6e4a0df6f
commit 6f3b252819
5 changed files with 39 additions and 39 deletions

View File

@@ -2,32 +2,32 @@ package set
type Set[T comparable] map[T]bool
func (this *Set[T]) Add(items ...T) {
func (s *Set[T]) Add(items ...T) {
for _, item := range items {
(*this)[item] = true
(*s)[item] = true
}
}
func (this Set[T]) Has(item T) bool {
return this[item] == true
func (s Set[T]) Has(item T) bool {
return s[item] == true
}
func (this *Set[T]) Remove(items ...T) {
func (s *Set[T]) Remove(items ...T) {
for _, item := range items {
delete(*this, item)
delete(*s, item)
}
}
func (this *Set[T]) Union(o Set[T]) {
func (s *Set[T]) Union(o Set[T]) {
for item := range o {
this.Add(item)
s.Add(item)
}
}
func (this Set[T]) ToList() []T {
func (s Set[T]) ToList() []T {
list := []T{}
for item := range this {
for item := range s {
list = append(list, item)
}