We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f3579bd commit 0c06111Copy full SHA for 0c06111
hashset.go
@@ -6,6 +6,7 @@ import (
6
)
7
8
// Set represents a thread-safe collection of unique elements.
9
+
10
type Set struct {
11
mu sync.RWMutex // Guards access to the internal hash map.
12
hash map[interface{}]bool // Stores elements as keys with a boolean value.
@@ -20,6 +21,7 @@ func New(initialValue ...interface{}) *Set {
20
21
v := reflect.ValueOf(iv)
22
if v.Kind() == reflect.Slice {
23
for i := 0; i < v.Len(); i++ {
24
+ // TODO: Optimize destructuring slice
25
s.Add(v.Index(i).Interface())
26
}
27
} else {
0 commit comments