Generic sortedmap of Golang. Golang 泛型 sortedmap 实现。
Need v1.18+
Example
{
hash := sortedmap.New[int, int]()
for i := 0; i < 10; i++ {
sm.Set(i, i)
}
sm.ForEach(func(key, val int) {
println(key, val)
})
// 0 1 2 3 4 5 6 7 8 9
}
go get github.com/shalldie/gog/sortedmap
sortedmap is a collection that has sorted elements, the usage can refer to HashMap.
sortedmap 是一个含有排序元素的集合,使用方式可参考 HashMap。
MIT