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

@@ -1540,14 +1540,14 @@ func main() {
}
```
### <span id="SortByKeys">SortByKeys</span>
### <span id="SortByKey">SortByKey</span>
<p>Sorts the map by its keys and returns a new map with sorted keys.</p>
<b>Signature:</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>Example:<span style="float:right;display:inline-block;">[运行]()</span></b>
@@ -1568,7 +1568,7 @@ func main() {
2: "b",
}
result := maputil.SortByKeys(m)
result := maputil.SortByKey(m)
fmt.Println(result)