Removes the eldest {@code n} elements.

@throws NoSuchElementException if the queue is empty
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);
  }
491122
public E removeFirst() {
    E first = getFirst();
    swap(0, size - 1);
    size--;
    elements.remove(size);
    heapifyDown(0);
    return first;
  }
237887
@Override
    public final T remove() {
        // Short circuit using read-lock
        if (this.isEmpty()) {
            throw new NoSuchElementException();
        }

        final T e = this.poll();
        if (e == null) {
            throw new NoSuchElementException();
        }
        return e;
    }
68186
public void removeNode(int n)
  {

    if (!m_mutable)
      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");

    this.removeElement(n);
  }
768901
public void clear() {
        fullyLock();
        try {
            for (Node<E> p, h = head; (p = h.next) != null; h = p) {
                h.next = sentinel();
                p.item = null;
            }
            head = last;
            // assert head.item == null && head.next == null;
            if (count.getAndSet(0) == capacity)
                notFull.signal();
        } finally {
            fullyUnlock();
        }
    }
611366
public void removeRange(int first, int last) {
        int ele;

        for (ele = first; ele <= last; ele++) {
            remove(ele);
        }
    }
68936
@Override
  public boolean removeEldestEntry(Map.Entry eldest) {
    boolean mustBeRemoved = this.size() > maxSize;

    if (mustBeRemoved) {
      ServerPrepareResult serverPrepareResult = ((ServerPrepareResult) eldest.getValue());
      serverPrepareResult.setRemoveFromCache();
      if (serverPrepareResult.canBeDeallocate()) {
        try {
          protocol.forceReleasePrepareStatement(serverPrepareResult.getStatementId());
        } catch (SQLException e) {
          //eat exception
        }
      }
    }
    return mustBeRemoved;
  }
1121569
public void keepTopNElements(int N){
        PriorityQueue<Pair<T, Double>> queue = asPriorityQueue();
        clear();
        for (int e = 0; e < N; e++) {
            Pair<T, Double> pair = queue.poll();
            if (pair != null)
                incrementCount(pair.getFirst(), pair.getSecond());
        }
    }
712050
private void clean() {
        Iterator<Entry<K, WeakReference<V>>> iter = entrySet().iterator();
        while (iter.hasNext()) {
            Entry<K, WeakReference<V>> e = iter.next();
            if (e != null && e.getValue() != null
                && e.getValue().get() == null) {
                iter.remove();
            }
        }
    }
1184626
private void heapify() {
        Object[] array = queue;
        int n = size;
        int half = (n >>> 1) - 1;
        Comparator<? super E> cmp = comparator;
        if (cmp == null) {
            for (int i = half; i >= 0; i--)
                siftDownComparable(i, (E) array[i], array, n);
        }
        else {
            for (int i = half; i >= 0; i--)
                siftDownUsingComparator(i, (E) array[i], array, n, cmp);
        }
    }
6953
function ( n ) { 

        var i = this.uis.indexOf( n ); 
        if ( i !== -1 ) {
            this.inner.removeChild( this.uis[i].c[0] );
            this.uis.splice( i, 1 ); 
        }

    }
845890
public void remove( int index )
	{
		if( (index < 0) || (index >= size) )
		{
			throw new IndexOutOfBoundsException();
		}

		--size;
		for( int i = index; i < size; ++i )
		{
			array[i] = array[i + 1];
		}

		array[size] = null;
	}
263555
@SuppressWarnings("unchecked")
  public T clearQueue(String name) {
    for (Element e : elements()) {
      queue(e, name, null).clear();
    }
    return (T) this;
  }
651481
protected void doDelete(int n) throws CorruptIndexException, IOException {
        if (transientDeletions) {
            deletedDocs.add(n);
            modCount.incrementAndGet(); // doDelete won't be executed, so incrementing modCount
        } else {
            super.doDelete(n);
            modCount.incrementAndGet();
        }
    }
1148779
public void remove(QueueElement qe) {

		if (head == qe) {
			removeHead();
		} else if (tail == qe) {
			removeTail();
		} else {
			qe.previous.next = qe.next;
			qe.next.previous = qe.previous;
			qe.previous = null;
			qe.next = null;
			qe.queue = null;
			numElements--;
		}

	}
1024834
public void removeDocumentFromCache(int n)
  {
    if(DTM.NULL ==n)
      return;
    for(int i=m_sourceTree.size()-1;i>=0;--i)
    {
      SourceTree st=(SourceTree)m_sourceTree.elementAt(i);
      if(st!=null && st.m_root==n)
      {
	m_sourceTree.removeElementAt(i);
	return;
      }
    }
  }
881057
@Override
   public void clear()
   {
      for (int i = 0; i < size; i++) {
         elementData[i] = null;
      }

      size = 0;
   }