// sortKeys is a quick helper to return the sorted set of a map's keys
966175
func sortKeys(vals map[string]counter) (keys []string) {
	for k := range vals {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	return keys
}
489760
func (m ConcurrentMap) Keys() []string {
	count := m.Count()
	ch := make(chan string, count)
	go func() {
		// Foreach shard.
		wg := sync.WaitGroup{}
		wg.Add(SHARD_COUNT)
		for _, shard := range m {
			go func(shard *ConcurrentMapShared) {
				// Foreach key, value pair.
				shard.RLock()
				for key := range shard.items {
					ch <- key
				}
				shard.RUnlock()
				wg.Done()
			}(shard)
		}
		wg.Wait()
		close(ch)
	}()

	// Generate keys
	keys := make([]string, 0, count)
	for k := range ch {
		keys = append(keys, k)
	}
	return keys
}
199723
func sortedConcatStringMap(m map[string]*string) string {
	var strList []string
	mapKeys := sortStringMapKeys(m)
	for _, key := range mapKeys {
		strList = append(strList, key, *m[key])
	}
	return strings.Join(strList, "-")
}
1200703
func getKeys(info map[string]interface{}, keysSet map[string]bool) {
	for k, v := range info {
		if strings.Contains(k, "*") {
			kew := strings.Replace(k, "*", "", 1)
			keysSet[kew] = true
		}

		listofouts, ok := v.([]interface{})
		if ok {
			for i := range listofouts {
				aux, ok := listofouts[i].(map[string]interface{})
				if !ok {
					continue
				}
				getKeys(aux, keysSet)
			}
		}

		if aux, ok := v.(map[string]interface{}); ok {
			getKeys(aux, keysSet)
		}
	}
}
1187024
func keyKeys(xu *xgbutil.XUtil) []xgbutil.KeyKey {
	xu.KeybindsLck.RLock()
	defer xu.KeybindsLck.RUnlock()

	keys := make([]xgbutil.KeyKey, len(xu.Keybinds))
	i := 0
	for key, _ := range xu.Keybinds {
		keys[i] = key
		i++
	}
	return keys
}
349160
func (l Keys) Keys() []string {
	list := make([]string, len(l))
	for i := range l {
		list[i] = l[i].String()
	}
	return list
}
1089597
func (hm *SyncedHashMap) Keys() (ch chan Hashable) {
	ch = make(chan Hashable)
	go func() {
		hm.RLock()
		defer hm.RUnlock()
		defer close(ch)
		for _, v := range hm.keys {
			ch <- v
		}
	}()
	return
}
458499
func (its injectionTypes) Keys() []reflect.Type {
	types := make([]reflect.Type, len(its))
	i := 0
	for t := range its {
		types[i] = t
		i++
	}
	sort.Slice(types, func(i, j int) bool {
		return types[i].Name() < types[j].Name()
	})
	return types
}
1140895
func (r *ring) keys(sorted bool) [][]byte {
	keys := make([][]byte, 0, atomic.LoadInt64(&r.keysHint))
	for _, p := range r.partitions {
		keys = append(keys, p.keys()...)
	}

	if sorted {
		bytesutil.Sort(keys)
	}
	return keys
}
1190928
func SortedKeys(m interface{}, t reflect.Type) interface{} {
	v := reflect.ValueOf(m)
	if v.Kind() != reflect.Map {
		panic("wrong type")
	}

	s := reflect.MakeSlice(reflect.SliceOf(v.Type().Key()), v.Len(), v.Len())
	for i, k := range v.MapKeys() {
		s.Index(i).Set(k)
	}

	s = s.Convert(t)
	sort.Sort(s.Interface().(sort.Interface))

	return s.Interface()
}
988141
func (pl *PairList) Keys() []string {
	keys := make([]string, 0, len(pl.Pairs))
	for k := range pl.Pairs {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	return keys
}
996694
func SortTags(tags map[string]string) [][]string {
	keys := make([]string, len(tags))
	result := make([][]string, len(tags))
	i := 0
	for k := range tags {
		keys[i] = k
		i++
	}
	sort.Strings(keys)
	for i, k := range keys {
		result[i] = []string{k, tags[k]}
	}
	return result
}
1262739
func processKeys(keys map[rune]kb.Key) ([]byte, []byte, error) {
	// order rune keys
	idx := make([]rune, len(keys))
	var i int
	for c := range keys {
		idx[i] = c
		i++
	}
	sort.Slice(idx, func(a, b int) bool {
		return idx[a] < idx[b]
	})

	// process
	var constBuf, mapBuf bytes.Buffer
	for _, c := range idx {
		key := keys[c]

		g, isGoCode := goCodes[c]
		s := fmt.Sprintf("\\u%04x", c)
		if isGoCode {
			s = g
		} else if key.Print {
			s = fmt.Sprintf("%c", c)
		}

		// add key definition
		v := strings.TrimPrefix(fmt.Sprintf("%#v", key), "kb.")
		v = nameRE.ReplaceAllString(v, "")
		mapBuf.WriteString(fmt.Sprintf("'%s': &%s,\n", s, v))

		// fix 'Quote' const
		if s == `\'` {
			s = `'`
		}

		// add const definition
		if (isGoCode && c != '\n') || !key.Print {
			n := strings.TrimPrefix(key.Key, ".")
			if n == `'` || n == `\` {
				n = key.Code
			}

			constBuf.WriteString(fmt.Sprintf("%s = \"%s\"\n", n, s))
		}
	}

	return constBuf.Bytes(), mapBuf.Bytes(), nil
}
157903
func (al HALLinks) Keys() (keys []string) {
	keys = make([]string, len(al.links))
	for i, l := range al.links {
		keys[i] = l.Name
	}
	return
}
1091735
func (db *RedisDB) allKeys() []string {
	res := make([]string, 0, len(db.keys))
	for k := range db.keys {
		res = append(res, k)
	}
	sort.Strings(res) // To make things deterministic.
	return res
}
127621
func (m *clientConnMap) Keys() []string {
	m.RLock()

	res := make([]string, 0, len(m.conns))
	for k := range m.conns {
		res = append(res, k)
	}

	m.RUnlock()
	return res
}
904821
func (e *EnvMap) Keys() []string {
	var keys []string
	for k, _ := range e.Map() {
		keys = append(keys, k)
	}

	return keys
}