GetMapKeysSorted returns the map's keys as a sorted slice. The keys are sorted in ascending order. For descending order, use GetMapKeysSortedDescending.
(m map[K]V)
| 39 | // GetMapKeysSorted returns the map's keys as a sorted slice. The keys are sorted in ascending order. For descending |
| 40 | // order, use GetMapKeysSortedDescending. |
| 41 | func GetMapKeysSorted[K cmp.Ordered, V any](m map[K]V) []K { |
| 42 | allKeys := GetMapKeys(m) |
| 43 | sort.Slice(allKeys, func(i, j int) bool { |
| 44 | return allKeys[i] < allKeys[j] |
| 45 | }) |
| 46 | return allKeys |
| 47 | } |
| 48 | |
| 49 | // GetMapKeysSortedDescending returns the map's keys as a sorted slice. The keys are sorted in descending order. For |
| 50 | // ascending order, use GetMapKeysSorted. |
no test coverage detected