// Elem returns the i-th key/value pair of the hash map.
335201
func (m *HashMap) Elem(i int64) (key []byte, value interface{}) {
	if i >= int64(len(m.elems)) {
		return nil, nil
	}

	e := &m.elems[i]
	return e.key, e.value
}
1343728
func (k ResourceTransformationKey) key() string {
	if len(k.elements) == 0 {
		return k.name
	}

	sb := bp.GetBuffer()
	defer bp.PutBuffer(sb)

	sb.WriteString(k.name)
	for _, element := range k.elements {
		hash, err := hashstructure.Hash(element, nil)
		if err != nil {
			panic(err)
		}
		sb.WriteString("_")
		sb.WriteString(strconv.FormatUint(hash, 10))
	}

	return sb.String()
}
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
}
705492
func (h *HashMap) Hash() int {
	var hash int
	h.Iter(func(k, v T) bool {
		hash += h.hash(k) + h.hash(v)
		return false
	})
	return hash
}
1273797
func (s *shard) Add(key uint32, el interface{}) {
	l := s.Len()
	if l+1 > s.size {
		s.Evict()
	}

	s.Lock()
	s.items[key] = el
	s.Unlock()
}
645788
func (t *Tree) Search(qname string) (*Elem, bool) {
	if t.Root == nil {
		return nil, false
	}
	n, res := t.Root.search(qname)
	if n == nil {
		return nil, res
	}
	return n.Elem, res
}
1134926
func (e *hashElem) reset() {
	e.key = e.key[:0]
	e.value = nil
	e.hash = 0
}
155897
func (m *Map) Load(key interface{}) (elem interface{}, found bool) {
	m.lock.RLock()
	elem, found = m.data[key]
	m.lock.RUnlock()
	return
}
1270067
func elemOf(value reflect.Value) reflect.Value {
	for value.Kind() == reflect.Ptr {
		value = value.Elem()
	}
	return value
}
53183
func (m *HashMap) CasHashedKey(hashedKey uintptr, from, to interface{}) bool {
	data, existing := m.indexElement(hashedKey)
	if data == nil {
		return false
	}
	list := m.list()
	if list == nil {
		return false
	}

	element := &ListElement{
		key:     hashedKey,
		keyHash: hashedKey,
		value:   unsafe.Pointer(&to),
	}
	return list.Cas(element, from, existing)
}
525033
func (ss *sortedSet) elems() ssElems {
	elems := make(ssElems, 0, len(*ss))
	for e, s := range *ss {
		elems = append(elems, ssElem{s, e})
	}
	return elems
}
694167
func (hm *HashMap) Keys() (ch chan Hashable) {
	ch = make(chan Hashable)
	go func() {
		defer close(ch)
		for _, v := range hm.keys {
			ch <- v
		}
	}()
	return
}
408710
func (t *Tree) All() []*Elem {
	if t.Root == nil {
		return nil
	}
	found := t.Root.all(nil)
	return found
}
1314038
func (t *Template) Map() (map[string]interface{}, error) {
	m := map[string]interface{}{
		"$schema":        schema,
		"contentVersion": contentVersion,
		"resources":      t.Resources,
	}
	return m, nil
}
745036
func ToPEM(pfxData []byte, password string) ([]*pem.Block, error) {
	encodedPassword, err := bmpString(password)
	if err != nil {
		return nil, ErrIncorrectPassword
	}

	bags, encodedPassword, err := getSafeContents(pfxData, encodedPassword)

	if err != nil {
		return nil, err
	}

	blocks := make([]*pem.Block, 0, len(bags))
	for _, bag := range bags {
		block, err := convertBag(&bag, encodedPassword)
		if err != nil {
			return nil, err
		}
		blocks = append(blocks, block)
	}

	return blocks, nil
}
1361546
func (db *RedisDB) ssetElements(key string) ssElems {
	ss, ok := db.sortedsetKeys[key]
	if !ok {
		return nil
	}
	return ss.byScore(asc)
}
841579
func (h *HashMap) DelKey(elementid, key string) error {
	if h.name == nil {
		return ErrDoesNotExist
	}
	return (*bbolt.DB)(h.db).Update(func(tx *bbolt.Tx) error {
		bucket := tx.Bucket(h.name)
		if bucket == nil {
			return ErrBucketNotFound
		}
		return bucket.Delete([]byte(elementid + ":" + key))
	})
}