This remove method is most efficient when the element being removed
is the last element.  Equality is identity based, not equals() based.
Only the first matching element is removed.

@param element the element to remove
507375
@Override
   public boolean remove(Object element)
   {
      for (int index = size - 1; index >= 0; index--) {
         if (element == elementData[index]) {
            final int numMoved = size - index - 1;
            if (numMoved > 0) {
               System.arraycopy(elementData, index + 1, elementData, index, numMoved);
            }
            elementData[--size] = null;
            return true;
         }
      }

      return false;
   }
1229194
public static Element removeScriptTags(Element element) {

        NodeList<Element> scriptTags = element.getElementsByTagName(Tag.script.name());
        // iterate backwards over list to ensure all tags get removed
        for (int i = scriptTags.getLength() - 1; i >= 0; i--) {
            scriptTags.getItem(i).removeFromParent();
        }
        return element;
    }
1216241
public <T> void clear(ElementDescriptor<T> property)
	{
		if (mSet != null)
		{
			mSet.remove(property);
		}
	}
1081541
public GridCellElement<P> removeElement(P element) {
		final GridCellElement<P> elt = remove(element);
		if (elt != null) {
			if (elt.removeCellLink(this)) {
				--this.referenceElementCount;
			}
		}
		return elt;
	}
367913
public void remove(final String[] pl, final boolean fwd) {
	synchronized (this) {
	    for (final String element : pl) {
		remove_i(element, fwd);
	    }
	}
    }
475352
void removeElement(int element_handle) {
		if (m_b_store_duplicates)
			throw new GeometryException("invalid call");

		int quad_handle = get_quad_(element_handle);
		disconnect_element_handle_(element_handle);
		free_element_and_box_node_(element_handle);

		int q = quad_handle;

		while (q != -1) {
			set_sub_tree_element_count_(q, get_sub_tree_element_count_(q) - 1);
			int parent = get_parent_(q);

			if (get_sub_tree_element_count_(q) == 0) {
				assert (get_local_element_count_(q) == 0);

				if (q != m_root) {
					int quadrant = get_quadrant_(q);
					m_quad_tree_nodes.deleteElement(q);
					set_child_(parent, quadrant, -1);
				}
			}

			q = parent;
		}
	}
117134
public void pop(int element) {
    assert this.contains(element);
    int i = this.pos.get(element);
    this.pos.set(element, -1);
    int last = this.heap.back();
    this.heap.pop();
    int j = this.heap.size();
    if (i == j)
      return;
    assert i < j;
    this.pos.set(last, i);
    this.heap.set(i, last);
    this.up(last);
    this.down(last);
  }
397968
public function remove($element)
    {
        $index = $this->indexOf($element);

        if ($index !== false) {
            unset($this->_items[$index]);
            $this->_items = array_values($this->_items);
            $this->_iterator = null;
            return true;
        }
        return false;
    }
1228582
public T removeLast()
   {
      T element = elementData[--size];
      elementData[size] = null;
      return element;
   }
369776
@Override
    public boolean remove(Object o) {
        if (elements.remove(o)) {
            ordered.remove(o);
            return true;
        } else {
            return false;
        }

    }
450067
public static void removeLastChild(Element tag) {
    final Node last = tag.getLastChild();
    if(last != null) {
      tag.removeChild(last);
    }
  }
148246
public synchronized void removeElement(T element) {
    checkArgument(
        element.getNext() != null || element.getPrev() != null || element == head,
        "Element not in the list.");
    size--;
    T prev = element.getPrev();
    T next = element.getNext();
    if (prev == null) {
      // This is the first element
      head = next;
      if (head != null) {
        // If more than one element in the list.
        head.setPrev(null);
        element.setNext(null);
      }
    } else if (next == null) {
      // This is the last element, and there is at least another element because
      // element.getPrev() != null.
      prev.setNext(null);
      element.setPrev(null);
    } else {
      prev.setNext(element.getNext());
      next.setPrev(element.getPrev());
      element.setNext(null);
      element.setPrev(null);
    }
  }
517053
private void removeObsoleteElements(List<String> names,
                                        Map<String, View> sharedElements,
                                        List<String> elementsToRemove) {
        if (elementsToRemove.size() > 0) {
            names.removeAll(elementsToRemove);
            for (String elementToRemove : elementsToRemove) {
                sharedElements.remove(elementToRemove);
            }
        }
    }
548034
function(element) {
    element = $(element);
    var node = element.firstChild;
    while (node) {
      var nextNode = node.nextSibling;
      if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
        element.removeChild(node);
      node = nextNode;
    }
    return element;
  }
1194885
def remove(self, element):
        
        if element in self._map:
            return self.evolver().remove(element).persistent()

        raise KeyError("Element '%s' not present in PSet" % element)
18657
public synchronized void remove(int n) throws IOException {
    if (isEmpty()) {
      throw new NoSuchElementException();
    }
    if (n < 0) {
      throw new IllegalArgumentException("Cannot remove negative (" + n + ") number of elements.");
    }
    if (n == 0) {
      return;
    }
    if (n == elementCount) {
      clear();
      return;
    }
    if (n > elementCount) {
      throw new IllegalArgumentException(
          "Cannot remove more elements (" + n + ") than present in queue (" + elementCount + ").");
    }

    final int eraseStartPosition = first.position;
    int eraseTotalLength = 0;

    // Read the position and length of the new first element.
    int newFirstPosition = first.position;
    int newFirstLength = first.length;
    for (int i = 0; i < n; i++) {
      eraseTotalLength += Element.HEADER_LENGTH + newFirstLength;
      newFirstPosition = wrapPosition(newFirstPosition + Element.HEADER_LENGTH + newFirstLength);
      ringRead(newFirstPosition, buffer, 0, Element.HEADER_LENGTH);
      newFirstLength = readInt(buffer, 0);
    }

    // Commit the header.
    writeHeader(fileLength, elementCount - n, newFirstPosition, last.position);
    elementCount -= n;
    first = new Element(newFirstPosition, newFirstLength);

    // Commit the erase.
    ringErase(eraseStartPosition, eraseTotalLength);
  }
494460
function removeFsElement (element) {
  let index = fsElements.indexOf(element)
  if (index !== -1) {
    fsElements.splice(index, 1)
  }
}