Add function PrintMap() in Go

This commit is contained in:
machangxin
2022-12-16 10:55:28 +08:00
parent e432f0b987
commit 26ad485dd2
3 changed files with 13 additions and 8 deletions
+8 -1
View File
@@ -1,6 +1,6 @@
// File: print_utils.go
// Created Time: 2022-12-03
// Author: Reanon (793584285@qq.com), Krahets (krahets@163.com)
// Author: Reanon (793584285@qq.com), Krahets (krahets@163.com), msk397 (machangxinq@gmail.com)
package pkg
@@ -96,3 +96,10 @@ func showTrunk(t *trunk) {
showTrunk(t.prev)
fmt.Print(t.str)
}
// PrintHashMap Print a hash map
func PrintMap(m map[int]string) {
for key, value := range m {
fmt.Printf("%d -> %s\n", key, value)
}
}