// Removes and returns the element at index i
163972
func Remove(h Interface, i int) (v interface{}) {
	n := h.Len() - 1
	if n != i {
		h.Swap(n, i)
		shuffleDown(h, i, n)
		shuffleUp(h, i)
	}
	return h.Pop()
}
957859
func (s *set) remove(elt setElement) bool {
	_, ok := s.m[elt]
	if !ok {
		return false
	}
	delete(s.m, elt)
	return true
}
1322598
func (l *segmentList) Remove(e *segment) {
	prev := segmentElementMapper{}.linkerFor(e).Prev()
	next := segmentElementMapper{}.linkerFor(e).Next()

	if prev != nil {
		segmentElementMapper{}.linkerFor(prev).SetNext(next)
	} else {
		l.head = next
	}

	if next != nil {
		segmentElementMapper{}.linkerFor(next).SetPrev(prev)
	} else {
		l.tail = prev
	}
}
1060419
func Remove(obj interface{}, pointer string) (rv interface{}, err error) {
	defer func() {
		if e := recover(); e != nil {
			err = fmt.Errorf("invalid JSON pointer: %q: %v", pointer, e)
		}
	}()
	tokens, err := parse(pointer)
	if err != nil {
		return nil, err
	}

	i := 0
	v := reflect.ValueOf(obj)
	var p, pp reflect.Value
	var token, ptoken string
	if len(tokens) > 0 && tokens[0] != "" {
		for i < len(tokens) {
			for v.Kind() == reflect.Interface {
				v = v.Elem()
			}
			pp = p
			p = v
			ptoken = token
			token = tokens[i]
			if n, err := strconv.Atoi(token); err == nil && isIndexed(v) {
				v = v.Index(n)
			} else {
				v = v.MapIndex(reflect.ValueOf(token))
			}
			i++
		}
	} else {
		return nil, fmt.Errorf("pointer should have element")
	}

	var nv reflect.Value
	if p.Kind() == reflect.Map {
		nv = reflect.MakeMap(p.Type())
		for _, mk := range p.MapKeys() {
			if mk.String() != token {
				nv.SetMapIndex(mk, p.MapIndex(mk))
			}
		}
	} else {
		nv = reflect.Zero(p.Type())
		n, _ := strconv.Atoi(token)
		for m := 0; m < p.Len(); m++ {
			if n != m {
				nv = reflect.Append(nv, p.Index(m))
			}
		}
	}

	if !pp.IsValid() {
		obj = nv.Interface()
	} else if pp.Kind() == reflect.Map {
		pp.SetMapIndex(reflect.ValueOf(ptoken), nv)
	} else {
		p.Set(reflect.ValueOf(nv))
	}
	return obj, nil
}
47575
func (l *State) Replace(index int) {
	l.checkElementCount(1)
	l.move(index, l.stack[l.top-1])
	l.top--
}
1294333
func (l *ByteIntervalList) Remove(e *ByteIntervalElement) ByteInterval {
	if e.list == l {
		// if e.list == l, l must have been initialized when e was inserted
		// in l or l == nil (e is a zero Element) and l.remove will crash
		l.remove(e)
	}
	return e.Value
}
423253
func (s *Selection) Index() int {
	if len(s.Nodes) > 0 {
		return newSingleSelection(s.Nodes[0], s.document).PrevAll().Length()
	}
	return -1
}
763139
func (s *Selection) Remove() *Selection {
	for _, n := range s.Nodes {
		if n.Parent != nil {
			n.Parent.RemoveChild(n)
		}
	}

	return s
}
41718
func (t *PairTree) RemoveAt(index int) *Pair {
	v := t.ObjectTree.RemoveAt(index)
	if v != nil {
		x := v.(Pair)
		return &x
	}
	return nil
}
269123
func (p *Poller) Remove(id int) error {
	if id >= 0 && id < len(p.items) {
		if id == len(p.items)-1 {
			p.items = p.items[:id]
			p.socks = p.socks[:id]
		} else {
			p.items = append(p.items[:id], p.items[id+1:]...)
			p.socks = append(p.socks[:id], p.socks[id+1:]...)
		}
		return nil
	}
	return ErrorNoSocket
}
15424
func (l *ItemList) remove(e *ItemElement) *ItemElement {
	e.prev.next = e.next
	e.next.prev = e.prev
	e.next = nil // avoid memory leaks
	e.prev = nil // avoid memory leaks
	e.list = nil
	l.len--
	return e
}
1034551
func (c *Cache) removeElement(elem *list.Element) {
	it := c.l.Remove(elem).(*Item)
	delete(c.m, it.Key)
	// Update cached byte size.
	c.size -= it.Size
	// Call handler if it exists.
	if c.config.RemoveHandler != nil {
		c.config.RemoveHandler(*it)
	}
}
317582
func (l *lNode) removed(e *Entry) *lNode {
	idx := l.FindIndex(func(sn interface{}) bool {
		return bytes.Equal(e.Key, sn.(*sNode).Key)
	})
	if idx < 0 {
		return l
	}
	nl, _ := l.Remove(uint(idx))
	return &lNode{nl}
}
1240256
func (c *LRU) removeElement(e *list.Element) {
	c.evictList.Remove(e)
	kv := e.Value.(*entry)
	delete(c.items, kv.key)
	if c.onEvict != nil {
		c.onEvict(kv.key, kv.value)
	}
}
504614
func (pq *BlockPriorityQueue) RemoveIndex(idx int) {
	removedHeight := pq.bh[idx].height
	heap.Remove(pq, idx)
	pq.RescanMinMaxForRemove(removedHeight)
}
291962
func (l *PacketIntervalList) Remove(e *PacketIntervalElement) PacketInterval {
	if e.list == l {
		// if e.list == l, l must have been initialized when e was inserted
		// in l or l == nil (e is a zero Element) and l.remove will crash
		l.remove(e)
	}
	return e.Value
}
703195
func (f *Form) RemoveButton(index int) *Form {
	f.buttons = append(f.buttons[:index], f.buttons[index+1:]...)
	return f
}