1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

refactoring: rename SortByKeys to SortByKey

This commit is contained in:
dudaodong
2024-08-28 10:58:14 +08:00
parent a6d39a3bba
commit ca40b5d6c6
5 changed files with 25 additions and 19 deletions

View File

@@ -56,7 +56,7 @@ import (
- [ConcurrentMap_Has](#ConcurrentMap_Has)
- [ConcurrentMap_Range](#ConcurrentMap_Range)
- [GetOrSet](#GetOrSet)
- [SortByKeys](#SortByKeys)
- [SortByKey](#SortByKey)
<div STYLE="page-break-after: always;"></div>
@@ -1525,14 +1525,14 @@ func main() {
}
```
### <span id="SortByKeys">SortByKeys</span>
### <span id="SortByKey">SortByKey</span>
<p>对传入的map根据key进行排序返回排序后的map。</p>
<b>函数签名:</b>
```go
func SortByKeys[K constraints.Ordered, V any](m map[K]V) (sortedKeysMap map[K]V)
func SortByKey[K constraints.Ordered, V any](m map[K]V) (sortedKeysMap map[K]V)
```
<b>示例:<span style="float:right;display:inline-block;">[运行]()</span></b>
@@ -1553,7 +1553,7 @@ func main() {
2: "b",
}
result := maputil.SortByKeys(m)
result := maputil.SortByKey(m)
fmt.Println(result)