Retrieves and remove the top-most element, i.e., the element that is either the top of the stack or the head of
the queue, depending on the configured {@link AccessPolicy}.

@return the top-most element of the container
353740
public E retrieve() {
        switch (accessPolicy) {
            case LIFO:
                return deque.pollLast();
            case FIFO:
                return deque.pollFirst();
            default:
                throw new IllegalStateException("Illegal evict policy: " + evictPolicy);
        }
    }
753283
public StopStrategy getStopStrategy() {
        return this.stopStrategy = (null == this.stopStrategy ? new StopStrategy() {
            //A stop strategy which never stops retrying
            @Override public boolean shouldStop(int previousAttemptNumber, long delaySinceFirstAttemptInMillis) {
                return false;
            }
        } : this.stopStrategy);
    }
1368342
BaseRow removeLast() {
		Map.Entry<BaseRow, Collection<BaseRow>> last = treeMap.lastEntry();
		BaseRow lastElement = null;
		if (last != null) {
			Collection<BaseRow> list = last.getValue();
			lastElement = getLastElement(list);
			if (lastElement != null) {
				if (list.remove(lastElement)) {
					currentTopNum -= 1;
				}
				if (list.size() == 0) {
					treeMap.remove(last.getKey());
				}
			}
		}
		return lastElement;
	}
1070970
public T removeLast() {
        if ( this.lastNode == null ) {
            return null;
        }
        final T node = this.lastNode;
        this.lastNode = node.getPrevious();
        node.setPrevious( null );
        if ( this.lastNode != null ) {
            this.lastNode.setNext( null );
        } else {
            this.firstNode = null;
        }
        this.size--;
        return node;
    }
847908
public TransportApiResult<List<Stop>> getStops(StopQueryOptions options)
    {
    	if (options == null)
    	{
    		options = StopQueryOptions.defaultQueryOptions();
    	}
    	
    	return TransportApiClientCalls.getStops(tokenComponent, settings, options, null, null, null);
    }
955062
public function top()
    {
        $objects = array_values($this->_object_set->getArrayCopy());

        $object = null;
        if (isset($objects[0])) {
            $object  = $objects[0];
        }

        return $object;
    }
1352472
public synchronized E pop() {
        E       obj;
        int     len = size();

        obj = peek();
        removeElementAt(len - 1);

        return obj;
    }
985145
public E peek() {
        switch (accessPolicy) {
            case LIFO:
                return deque.peekLast();
            case FIFO:
                return deque.peekFirst();
            default:
                throw new IllegalStateException("Illegal evict policy: " + evictPolicy);
        }
    }
418999
protected T popFrontEntry() {
        if (head == null) {
            return null;
        }
        T next = head.getNext();
        if (next != null) {
            next.setPrev(null);
        } else {
            last = null;
        }
        T e = head;
        head = next;
        e.setNext(null);
        size--;
        return e;
    }
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;
  }
1241126
def get_top_priority(self):
        
        if self.is_empty():
            raise IndexError("Priority queue is empty.")
        _, _, element = heapq.heappop(self.pq)
        if element in self.element_finder:
            del self.element_finder[element]
        return element
338871
@Pure
	public Object getTopContainer() {
		if (this.mapContainer == null) {
			return null;
		}
		final C container = this.mapContainer.get();
		if (container == null) {
			return null;
		}
		if (container instanceof GISContentElement<?>) {
			return ((GISContentElement<?>) container).getTopContainer();
		}
		return container;
	}
785937
public T removeFirst() {
		if (isEmpty()) {
			return null;
		}
		T firstElement = elements[firstIndex];
		elements[firstIndex] = null;
		firstIndex = incrementIndex(firstIndex, 0);
		return firstElement;
	}
1039316
Access getDefaultAccess()
    {
        if (default_access != null)
            return default_access;

        if (parent_queue != null)
            return parent_queue.getDefaultAccess();

        return null;
    }
156546
@Weight(Weight.Unit.VARIABLE)
  @Nonnull
  public static StackTraceElement stackElement() {
    final StackTraceElement[] allElements = Thread.currentThread().getStackTrace();
    return allElements[2];
  }
1121837
@Override
    public final N pop() {

        int spin = 0;
        // now pop the stack
        for(;;) {
            final long writeLock = seqLock.tryWriteLock();
            if(writeLock > 0) {
                try {
                    final int stackTop = this.stackTop.get();
                    final int lastRef = stackTop-1;
                    if(stackTop>0) {
                        try {
                            // if we can modify the stack - i.e. nobody else is modifying
                            final N n = stack.get(lastRef);
                            stack.set(lastRef, null);
                            stackNotFullCondition.signal();
                            return n;
                        } finally {
                            this.stackTop.set(lastRef);
                        }
                    } else {
                        return null;
                    }
                } finally {
                    seqLock.unlock(writeLock);
                }
            }

            spin = Condition.progressiveYield(spin);

        }
    }
769775
public V poll() {
        if (oMinEntry == null) return null;

        final Entry minEntry = oMinEntry;

        // move minEntry's children to the root list
        Entry oFirstChild = minEntry.oFirstChild;
        if (oFirstChild != null) {
            for (Entry childOfMin : getCycle(oFirstChild)) {
                childOfMin.oParent = null;
            }
            mergeLists(oMinEntry, oFirstChild);
        }

        // remove minEntry from root list
        if (size == 1) {
            oMinEntry = null;
        }
        else {
            final Entry next = minEntry.next;
            unlinkFromNeighbors(minEntry);
            oMinEntry = consolidate(next);
        }
        size--;

        return minEntry.value;
    }