Skip to content

Latest commit

 

History

History

xmap

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

xmap

map 辅助函数

  • 有序遍历map(根据 mapKEY 进行排序,依次遍历)

例子

var tm = make(map[string]string)
tm["b"] = "c"
tm["a"] = "b"
tm["1"] = "2"
tm["c"] = "d"

WalkStringStringMapDeterministic(tm, func(k string, v string) bool {
    fmt.Println("key:", k, "value:", v)
    return true
})

Output:

key: 1 value: 2
key: a value: b
key: b value: c
key: c value: d