mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-11 19:30:59 +00:00
Add function PrintMap() in Go
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user