SortedKeys returns the keys of m in sorted order.
(m map[K]V)
| 32 | |
| 33 | // SortedKeys returns the keys of m in sorted order. |
| 34 | func SortedKeys[K constraints.Ordered, V any](m map[K]V) (keys []K) { |
| 35 | for k := range m { |
| 36 | keys = append(keys, k) |
| 37 | } |
| 38 | sort.Slice(keys, func(i, j int) bool { return keys[i] < keys[j] }) |
| 39 | return keys |
| 40 | } |
no outgoing calls