Last active
July 18, 2017 19:03
-
-
Save donutloop/3afc21d79c1d37f43c842414c252ac1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package maputil | |
type StringMap struct { | |
mapping map[string]string | |
order []string | |
} | |
func (sm *StringMap) Set(key, value string) { | |
sm.mapping[key] = value | |
sm.order = append(order, key) | |
} | |
func (sm *StringMap) Range(f func(string)) { | |
for _, s := range sm.order { | |
f(sm.mapping[s]) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment