// Merge is like Union, however it modifies the current set it's applied on
// with the given t set.
518046
func (s *Set) Merge(t Interface) {
	s.l.Lock()
	defer s.l.Unlock()

	t.Each(func(item interface{}) bool {
		s.m[item] = keyExists
		return true
	})
}
1243171
func (c *CountMinSketch) Merge(other *CountMinSketch) error {
	if c.depth != other.depth {
		return errors.New("matrix depth must match")
	}

	if c.width != other.width {
		return errors.New("matrix width must match")
	}

	for i := uint(0); i < c.depth; i++ {
		for j := uint(0); j < c.width; j++ {
			c.matrix[i][j] += other.matrix[i][j]
		}
	}

	c.count += other.count
	return nil
}
639256
func (e *ErrorRate) Merge(rate *ErrorRate) {
	e.QueryTotal += rate.QueryTotal
	e.ErrorTotal += rate.ErrorTotal
}
720748
func (s *StringValue) Merge(onto *string) {
	if s.v != nil {
		*onto = *(s.v)
	}
}
306618
func (s *SeriesIDSet) Merge(others ...*SeriesIDSet) {
	bms := make([]*roaring.Bitmap, 0, len(others)+1)

	s.RLock()
	bms = append(bms, s.bitmap) // Add ourself.

	// Add other bitsets.
	for _, other := range others {
		other.RLock()
		defer other.RUnlock() // Hold until we have merged all the bitmaps
		bms = append(bms, other.bitmap)
	}

	result := roaring.FastOr(bms...)
	s.RUnlock()

	s.Lock()
	s.bitmap = result
	s.Unlock()
}
863353
func (rs RuleSet) Merge(other RuleSet) RuleSet {
	result := NewRuleSet()
	for i := range rs {
		result.Add(rs[i])
	}
	for i := range other {
		result.Add(other[i])
	}
	return result
}
380240
func merge(c1 *fab.ChaincodeCall, c2 *fab.ChaincodeCall) (*fab.ChaincodeCall, bool) {
	c := &fab.ChaincodeCall{ID: c1.ID, Collections: c1.Collections}
	merged := false
	for _, coll := range c2.Collections {
		if !contains(c.Collections, coll) {
			c.Collections = append(c.Collections, coll)
			merged = true
		}
	}
	return c, merged
}
1055491
func (e PrimitiveElement) Merge(v Strategy) (Result, error) {
	return v.MergePrimitive(e)
}
400622
func Merge(e1, e2 interface{}) error {
	if e1 == nil && e2 == nil {
		return nil
	}
	if e1 != nil && e2 == nil {
		return newError(e1, 2)
	}
	if e1 == nil && e2 != nil {
		return newError(e2, 2)
	}
	switch val := e2.(type) {
	case *Error:
		if val == nil {
			return newm(e1)
		}
		prev := val
		for err := val.next; err != nil; err = err.next {
			prev = err
		}
		prev.next = newm(e1)
		return val
	case error:
		if val == nil {
			return newm(e1)
		}
		prev := newError(val, 2).(*Error)
		prev.next = newm(e1)
		return prev
	case string:
		if val == "" {
			return newm(e1)
		}
		prev := newError(val, 2).(*Error)
		prev.next = newm(e1)
		return prev
	default:
		panic("invalid type")
	}
	//panic("¯|_(ツ)_/¯")
}
791761
func merge(appliabels ...[]appliable) []appliable {
	all := []appliable{}

	for _, appl := range appliabels {
		all = append(all, appl...)
	}

	return all
}
71934
func (s Set) Union(other Set) Set {
	ret := make(Set, len(s))
	for k := range s {
		ret[k] = struct{}{}
	}
	for k := range other {
		ret[k] = struct{}{}
	}
	return ret
}
1356605
func (c *Context) Merge(data Data) Data {
	if data == nil {
		return dupeMaps(c.data)
	} else {
		return dupeMaps(c.data, data)
	}
}
48032
func Merge(coll1, coll2 []string) []string {
	m := map[string]struct{}{}
	for _, v := range append(coll1, coll2...) {
		m[v] = struct{}{}
	}
	r := make([]string, 0, len(m))
	for k := range m {
		r = append(r, k)
	}
	return r
}
534416
func (p *trie) merge(m matcher) (matcher, error) {
	other, ok := m.(*trie)
	if !ok {
		return nil, fmt.Errorf("Can't merge %T and %T", p, m)
	}
	mapper := p.mapper.equivalent(other.mapper)
	if mapper == nil {
		return nil, fmt.Errorf("Can't merge %T and %T", p, m)
	}

	root, err := p.root.merge(other.root)
	if err != nil {
		return nil, err
	}
	return &trie{root: root, mapper: mapper}, nil
}
632296
func Merge(base, override interface{}) interface{} {
	//reflect and recurse
	b := reflect.ValueOf(base)
	o := reflect.ValueOf(override)
	ret := mergeRecursive(b, o)

	return ret.Interface()
}
451003
func (c *Counter) Merge(v *metricpb.CounterValue) {
	c.value += v.Value
}
911216
func merge(envs ...map[string]string) map[string]string {
	merged := make(map[string]string)
	for _, env := range envs {
		for k, v := range env {
			merged[k] = v
		}
	}
	return merged
}