Skip to content

Commit 13e06d1

Browse files
committed
Added NewFromHashmap function
1 parent 6e20ca2 commit 13e06d1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

properties.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ func NewMap() *Map {
107107
}
108108
}
109109

110+
// NewFromHashmap creates a new Map from the given map[string]string.
111+
// Insertion order is not preserved.
112+
func NewFromHashmap(orig map[string]string) *Map {
113+
res := NewMap()
114+
for k, v := range orig {
115+
res.Set(k, v)
116+
}
117+
return res
118+
}
119+
110120
// Load reads a properties file and makes a Map out of it.
111121
func Load(filepath string) (*Map, error) {
112122
bytes, err := ioutil.ReadFile(filepath)

0 commit comments

Comments
 (0)