elliotchance / elliotchance/orderedmap

map is not sorted

Open
#20 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1k
Forks
77
PR merge metrics
No merged PRs in 30d

Description

```
var rs map[string][]byte

// 排序
m := orderedmap.NewOrderedMap()
for k, _ := range rs {
fmt.Printf(" |-set-> %v\n", el.Key)
m.Set(k, rs[k])
}

// You can also use Back and Prev to iterate in reverse:
for el := m.Back(); el != nil; el = el.Prev() {
fmt.Printf(" |-get-> %v\n", el.Key)
}
```

```
----> 检索记录,前缀: auth_file_rec-001203-0100000084-
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=23)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=24)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=25)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=26)]:
|---> auth_file_rec-001203-0100000084-%!s(int=26)
|---> auth_file_rec-001203-0100000084-%!s(int=25)
|---> auth_file_rec-001203-0100000084-%!s(int=24)
|---> auth_file_rec-001203-0100000084-%!s(int=23)


----> 检索记录,前缀: auth_file_rec-001203-0100000084-
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=23)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=24)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=25)]:
out--find more--> [auth_file_rec-001203-0100000084-%!s(int=26)]:
|---> auth_file_rec-001203-0100000084-%!s(int=24)
|---> auth_file_rec-001203-0100000084-%!s(int=23)
|---> auth_file_rec-001203-0100000084-%!s(int=26)
|---> auth_file_rec-001203-0100000084-%!s(int=25)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.