// Insert adds the item into the set.
// If an item with the same Key existed in the set, it is deleted and returned.
771184
func (s *RankedSet) Insert(item Item) Item {
	old := s.Delete(item)

	key := item.Key()
	value := &treeItem{item: item}

	s.rank.ReplaceOrInsert(value) // should always return nil because we call Delete first
	s.set[key] = value

	return old
}
214330
func (d *Diet) Insert(x, y uint64) {
	x, y = sortBoundaries(x, y)
	d.root = insert(x, y, d.root)
}
1349138
func (s Set) Insert(blob []byte) {
	shard := &s[ShardIndex(blob, len(s))]
	if *shard == nil {
		*shard = make(Shard)
	}
	(*shard)[string(blob)] = struct{}{}
}
501941
func (s *Set) Add(items ...interface{}) {
	if len(items) == 0 {
		return
	}

	s.l.Lock()
	defer s.l.Unlock()

	for _, item := range items {
		s.m[item] = keyExists
	}
}
727119
func (t *Trie) Insert(key []byte, value interface{}) bool {
	return t.insert(key, value, false)
}
1367672
func insert(q *waitForPriorityQueue, knownEntries map[t]*waitFor, entry *waitFor) {
	// if the entry already exists, update the time only if it would cause the item to be queued sooner
	existing, exists := knownEntries[entry.data]
	if exists {
		if existing.readyAt.After(entry.readyAt) {
			existing.readyAt = entry.readyAt
			heap.Fix(q, existing.index)
		}

		return
	}

	heap.Push(q, entry)
	knownEntries[entry.data] = entry
}
581407
func (b *BiMap) Insert(k interface{}, v interface{}) {
	b.s.RLock()
	if b.immutable {
		panic("Cannot modify immutable map")
	}
	b.s.RUnlock()

	b.s.Lock()
	defer b.s.Unlock()
	b.forward[k] = v
	b.inverse[v] = k
}
388247
func (m *Manager) Insert(c *GlobalConfig) error {
	err := m.collection.Insert(c)

	return err
}
364667
func (b *Builder) Insert(eq Eq) *Builder {
	b.inserts = eq
	b.optype = insertType
	return b
}
136619
func (a CollectionByKeys) Insert(tags map[string]string, data map[string]interface{}) CollectionByKeys {
	// If there is already a group with this set of tags, insert into it. Otherwise create a new group and insert
	if group := a.IsAvailable(tags); group != nil {
		for k, v := range data {
			group.data[k] = v
		}
	} else {
		a = append(a, DataGroup{len(tags), tags, data})
	}

	return a
}
577173
func (e *emptyList) Insert(val interface{}, pos uint) (PersistentList, error) {
	if pos == 0 {
		return e.Add(val), nil
	}
	return nil, ErrEmptyList
}
162640
func (s *UserStorage) Insert(c model.User) string {
	id := fmt.Sprintf("%d", s.idCount)
	c.ID = id
	s.users[id] = &c
	s.idCount++
	return id
}
1270738
func (s *Scope) Insert(obj *Object) (alt *Object) {
	if alt = s.Objects[obj.Name]; alt == nil {
		s.Objects[obj.Name] = obj
	}
	return
}
1016697
func (t *Transaction) Insert(list ...interface{}) error {
	return insert(t.dbmap, t, list...)
}
385478
func Insert(table string) *InsertBuilder {
	return &InsertBuilder{
		tableName: table,
		query:     fmt.Sprintln(`INSERT INTO`, table),
		lock:      new(sync.Mutex),
	}
}
1039873
func (t *Trie) Insert(key string) {
	curNode := t.root
	for _, v := range key {
		if curNode.child[v] == nil {
			curNode.child[v] = newNode()
		}
		curNode = curNode.child[v]
	}

	if !curNode.exists {
		// increment when new rune child is added.
		t.size++
		curNode.exists = true
	}
	// value is stored for retrieval in future.
	curNode.value = key
}
1292664
func (adapter *Adapter) Insert(query grimoire.Query, changes map[string]interface{}, loggers ...grimoire.Logger) (interface{}, error) {
	statement, args := NewBuilder(adapter.Config).Insert(query.Collection, changes)
	id, _, err := adapter.Exec(statement, args, loggers...)
	return id, err
}