MapKeysToSlice given the map, it converts the map keys to a slice.
(m map[K]V)
| 33 | |
| 34 | // MapKeysToSlice given the map, it converts the map keys to a slice. |
| 35 | func MapKeysToSlice[K comparable, V any](m map[K]V) []K { |
| 36 | s := make([]K, 0, len(m)) |
| 37 | for k := range m { |
| 38 | s = append(s, k) |
| 39 | } |
| 40 | return s |
| 41 | } |
no outgoing calls