Removes and returns the least element of the PriorityQueue in
log(size) time.

@return The least element.
771519
public final T poll() {
		if (size > 0) {
			T result = heap[1]; // save first value
			heap[1] = heap[size]; // move last to first
			heap[size] = null; // permit GC of objects
			size--;
			downHeap(); // adjust heap
			return result;
		} else {
			return null;
		}
	}
411297
public <T> Optional<T> min(Stream<T> stream, Comparator<? super T> comparator) {
        Callable<Optional<T>> callable = () -> stream.min(comparator);
        return ThreadMethods.forkJoinExecution(callable, concurrencyConfiguration, stream.isParallel());
    }
882258
def next(self):
        
        smallest = None
        for key in self.queue.keys():
            if self.queue[key]['status'] == 'queued':
                if smallest is None or key < smallest:
                    smallest = key
        return smallest
1143737
public LeftTupleSinkNode removeFirst() {
        if ( this.firstNode == null ) {
            return null;
        }
        final LeftTupleSinkNode node = this.firstNode;
        this.firstNode = node.getNextLeftTupleSinkNode();
        node.setNextLeftTupleSinkNode( null );
        if ( this.firstNode != null ) {
            this.firstNode.setPreviousLeftTupleSinkNode( null );
        } else {
            this.lastNode = null;
        }
        this.size--;
        return node;
    }
581836
public static Buffer getQueue(int size) {

        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(
                Messages.get().getBundle().key(Messages.INIT_PUBLISH_HISTORY_SIZE_SET_1, new Integer(size)));
        }

        return BufferUtils.synchronizedBuffer(TypedBuffer.decorate(new CircularFifoBuffer(size) {

            /** The serialization version id constant. */
            private static final long serialVersionUID = -6257542123241183114L;

            /**
             * Called when the queue is full to remove the oldest element.<p>
             *
             * @see org.apache.commons.collections.buffer.BoundedFifoBuffer#remove()
             */
            @Override
            public Object remove() {

                CmsPublishJobInfoBean publishJob = (CmsPublishJobInfoBean)super.remove();
                try {
                    OpenCms.getPublishManager().getEngine().getPublishHistory().remove(publishJob);
                } catch (CmsException exc) {
                    if (LOG.isErrorEnabled()) {
                        LOG.error(exc.getLocalizedMessage(), exc);
                    }
                }
                return publishJob;
            }
        }, CmsPublishJobInfoBean.class));
    }
580091
@Override
    @LogarithmicTime(amortized = true)
    public K deleteMin() {
        if (size == 0) {
            throw new NoSuchElementException();
        }

        // updated last deleted key
        lastDeletedKey = currentMin;

        if (currentMinBucket == 0) {
            buckets[currentMinBucket].remove(currentMinPos);

            // update minimum cache
            currentMin = null;
            currentMinBucket = EMPTY;
            currentMinPos = EMPTY;
            if (--size > 0) {
                findAndCacheMinimum(0);
            }
        } else {
            K newMin = null;
            int newMinBucket = EMPTY;
            int newMinPos = EMPTY;

            // redistribute all elements based on new lastDeletedKey
            int pos = 0;
            for (K val : buckets[currentMinBucket]) {
                if (pos != currentMinPos) {
                    int b = computeBucket(val, lastDeletedKey);
                    assert b < currentMinBucket;
                    buckets[b].add(val);

                    if (newMin == null || compare(val, newMin) < 0) {
                        newMin = val;
                        newMinBucket = b;
                        newMinPos = buckets[b].size() - 1;
                    }
                }
                ++pos;
            }
            buckets[currentMinBucket].clear();

            // update minimum cache
            currentMin = newMin;
            currentMinBucket = newMinBucket;
            currentMinPos = newMinPos;
            if (--size > 0) {
                findAndCacheMinimum(currentMinBucket + 1);
            }
        }

        return lastDeletedKey;
    }
1017153
public final T pop()
    {
        if (size > 0)
        {
            T result = heap[1]; // save first value
            heap[1] = heap[size]; // move last to first
            heap[size] = null; // permit GC of objects
            size--;
            downHeap(); // adjust heap
            return result;
        }
        else
        {
            return null;
        }
    }
523528
private E dequeue() {
        // assert lock.getHoldCount() == 1;
        // assert items[takeIndex] != null;
        final Object[] items = this.items;
        @SuppressWarnings("unchecked")
        E x = (E) items[takeIndex];
        items[takeIndex] = null;
        if (++takeIndex == items.length) takeIndex = 0;
        count--;
        if (itrs != null)
            itrs.elementDequeued();
        notFull.signal();
        return x;
    }
652621
public int getThreadsPriority()
    {
        int priority=Thread.NORM_PRIORITY;
        Object o=_pool.getAttribute(__PRIORITY);
        if(o!=null)
        {
            priority=((Integer)o).intValue();
        }
        return priority;
    }
1330213
@Override
	public E get() {
		if (originalElements.isEmpty()) {
			return null;
		}
		if (!priorityElements.isEmpty()) {
			return priorityElements.remove(0);
		}
		if (currentElements.size() <= originalElements.size()) {
			currentElements.addAll(originalElements);
		}
		int index = random.getInt(currentElements.size() - 1);
		return currentElements.remove(index);
	}
613025
@Override
    public boolean removeFirstOccurrence(E e) {
        boolean result = queue.removeFirstOccurrence(e);
        if (result) {
            addCapacity(-1);
        }
        return result;
    }
1187337
public E removeFirst() {
        final Node<E> f = first;
        if (f == null)
            throw new NoSuchElementException();
        return unlinkFirst(f);
    }
1270846
public QueueElement removeTail() {

		if (head == null) {
			return null;
		}

		QueueElement result = tail;
		if (result.previous == null) {
			head = null;
			tail = null;
		} else {
			tail = result.previous;
			tail.next = null;
		}
		result.previous = null;
		result.next = null;
		result.queue = null;

		numElements--;
		return result;

	}
778091
public E removeLast () {
		if (size > 0) {
			E e = data[--size];
			data[size] = null;
			return e;
		}

		return null;
	}
1311800
public T remove() {
        final Node<T> previous = iterator.currentNode.previous;
        final T element = remove(iterator.currentNode);
        iterator.currentNode = previous;
        return element;
    }
471043
public T remove() {
        lock.lock();

        try {
            if(queue.isEmpty())
                return null;
            El<T> el=queue.poll();
            count-=el.size;
            not_full.signalAll();
            return el.el;
        }
        finally {
            lock.unlock();
        }
    }
562479
public Node removeFirst()
    {
        Node node = header.getNextNode();
        firstByte += node.ba.last();
        return removeNode( node );
    }