(m map[string]uint32, n int)
| 62 | } |
| 63 | |
| 64 | func mapSliceN(m map[string]uint32, n int) mapSlice { |
| 65 | if n < 0 || n > len(m) { |
| 66 | panic(fmt.Sprintf("n value %d out of range for map size %d", n, len(m))) |
| 67 | } |
| 68 | in := make([]string, 0, n) |
| 69 | out := make([]string, 0, len(m)-n) |
| 70 | nAdded := 0 |
| 71 | |
| 72 | for k := range m { |
| 73 | if nAdded < n { |
| 74 | nAdded++ |
| 75 | in = append(in, k) |
| 76 | } else { |
| 77 | out = append(out, k) |
| 78 | } |
| 79 | } |
| 80 | return mapSlice{m: m, in: in, out: out} |
| 81 | } |
| 82 | |
| 83 | func (m mapSlice) AppendKeys(a []string) []string { return append(a, m.in...) } |
| 84 | func (m mapSlice) Get(s string) uint32 { return m.m[s] } |
no outgoing calls
no test coverage detected