feat: observer pattern for statistics
This commit is contained in:
@@ -18,8 +18,8 @@ func (s *Set[T]) Remove(items ...T) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Set[T]) Merge(o Set[T]) {
|
||||
for item := range o {
|
||||
func (s *Set[T]) Merge(o *Set[T]) {
|
||||
for item := range *o {
|
||||
s.Add(item)
|
||||
}
|
||||
}
|
||||
@@ -34,8 +34,8 @@ func (s Set[T]) ToList() []T {
|
||||
return list
|
||||
}
|
||||
|
||||
func New[T comparable](items ...T) Set[T] {
|
||||
result := Set[T]{}
|
||||
func New[T comparable](items ...T) *Set[T] {
|
||||
result := &Set[T]{}
|
||||
|
||||
for _, item := range items {
|
||||
result.Add(item)
|
||||
|
||||
Reference in New Issue
Block a user