-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset2.go
More file actions
46 lines (37 loc) · 868 Bytes
/
Copy pathset2.go
File metadata and controls
46 lines (37 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package mob
import mapset "github.com/deckarep/golang-set"
func NewSet() mapset.Set {
return mapset.NewThreadUnsafeSet()
}
func NewSetFrom[T any](vs ...T) mapset.Set {
return NewSetFromSlice(vs)
}
func NewSetFromSlice[T any](vs []T) mapset.Set {
set := mapset.NewThreadUnsafeSet()
for _, item := range vs {
set.Add(item)
}
return set
}
func NewConcurrentSet() mapset.Set {
return mapset.NewSet()
}
func NewConcurrentSetFrom[T any](vs ...T) mapset.Set {
return NewConcurrentSetFromSlice(vs)
}
func NewConcurrentSetFromSlice[T any](vs ...T) mapset.Set {
set := mapset.NewSet()
for _, item := range vs {
set.Add(item)
}
return set
}
func SetAdd(dst mapset.Set, vs ...interface{}) mapset.Set {
return SetFromSlice(dst, vs)
}
func SetFromSlice(dst mapset.Set, vs []interface{}) mapset.Set {
for _, it := range vs {
dst.Add(it)
}
return dst
}