1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-05-12 11:32:03 +08:00
parent 7930a64e59
commit 08309e4a49
7 changed files with 85 additions and 37 deletions

View File

@ -9,7 +9,12 @@ type hashMap[K constraints.Ordered, V any] struct {
}
func NewHashMap[K constraints.Ordered, V any](maps ...map[K]V) *hashMap[K, V] {
return &hashMap[K, V]{m: make(map[K]V)}
m := make(map[K]V)
if len(maps) > 0 {
m = Merge(maps...)
}
return &hashMap[K, V]{m: m}
}
// synchronized