LinkedList removeLast - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for LinkedList removeLast method.

This code example shows how to use the following methods:removeLast, size
    public T pop() { 
        LinkedList<T> list = stack.get();
        if (list == null) {
            return null; 
        } 
        T rtn = list.removeLast();
        if (list.size() == 0) {
            stack.remove();
        } 
        return rtn;
    } 
 
    public T get() { 
        LinkedList<T> list = stack.get();
        if (list == null) {
            return null; 
        } 
        return list.getLast();
    } 
} 
8
CodeRank
This code example shows how to use the following methods:removeLast, size
 
    @Override 
    public Object objectDone(){
        BSONObject o = (BSONObject)super.objectDone();
        String lastName = null;
        if ( _nameStack.size() > 0 ){
            lastName = _nameStack.removeLast();
        } 
        if ( ! ( o instanceof List ) && lastName != null &&
             o.containsField( "$ref" ) &&
             o.containsField( "$id" ) ){
            return cur().put(lastName, new DBRef( _db, o ) );
        } 
 
        return o;
    } 
 
    /** 
     * @return 
     * @throws MongoException 
8
CodeRank
This code example shows how to use the following methods:removeLast, size
    public T pop() { 
        LinkedList<T> list = stack.get();
        if (list == null) {
            return null; 
        } 
        T rtn = list.removeLast();
        if (list.size() == 0) {
            stack.remove();
        } 
        return rtn;
    } 
 
    public T peek() { 
        LinkedList<T> list = stack.get();
        if (list == null) {
            return null; 
        } 
        return list.getLast();
    } 
} 
8
CodeRank
This code example shows how to use the following methods:add, removeLast, size
        this.maxItems = maxItems;
        this.content = new LinkedList();
    } 
 
    public LimitedDescription append(String line) {
        content.add(0, line);
        if (content.size() > maxItems) {
            content.removeLast();
        } 
        return this;
    } 
     
    public String toString() {
        if (content.size() == 0) {
            return "<<empty>>"; 
        } 
 
        StringBuilder out = new StringBuilder();
        List reversed = Lists.reverse(content);
        for (Object item : reversed) {
7
CodeRank
This code example shows how to use the following methods:addFirst, removeLast, size
    public Symbol get(int position) { 
        return symbols.size() <= position ? Symbol.emptySymbol : symbols.get(position); 
    } 
 
    public void add(Symbol value)  { 
        symbols.addFirst(value); 
        if (symbols.size() > streamCapacity) symbols.removeLast(); 
    } 
 
    public boolean isEnd() { return symbols.isEmpty() || symbols.getFirst() == Symbol.emptySymbol; } 
 
    private static final int streamCapacity = 3; 
 
    private LinkedList<Symbol> symbols; 
} 
7
CodeRank
This code example shows how to use the following methods:add, removeLast, size
	private int maxPrevValues = 10; 
	private LinkedList<TSRelational> previous = new LinkedList<TSRelational>(); 
	private long rowNum = 0; 
 
	public void addPrevious(TSRelational lastValue) { 
		previous.add(0, lastValue); 
		if (previous.size() > maxPrevValues) 
			previous.removeLast(); 
	} 
	 
	public TSRelational previousRow(int index) { 
		return previous.get(index); 
	} 
	 
	public Object previousValue(int index, String columnName) { 
		if ((previous.size()-1)<index) 
			return null; 
		return previous.get(index).get(columnName); 
	} 
 
7
CodeRank
This code example shows how to use the following methods:isEmpty, getLast, removeLast
	 * @see org.springframework.batch.item.xml.stax.AbstractEventWriterWrapper#add(javax.xml.stream.events.XMLEvent) 
	 */ 
	@Override 
	public void add(XMLEvent event) throws XMLStreamException {
		if (isUnopenedElementCloseEvent(event)) {
			QName element = unopenedElements.removeLast();
			String nsPrefix = !StringUtils.hasText(element.getPrefix()) ? "" : element.getPrefix() + ":";
			try { 
				super.flush(); 
				ioWriter.write("</" + nsPrefix + element.getLocalPart() + ">");
				ioWriter.flush();
			} 
			catch (IOException ioe) {
				throw new DataAccessResourceFailureException("Unable to close tag: " + element, ioe);
			} 
		} else { 
			super.add(event);
		} 
	} 
 

6
CodeRank
This code example shows how to use the following methods:addFirst, removeLast, size
    protected synchronized void processPacket(Packet packet) {
        if (packet == null) {
            return; 
        } 
        // If the max number of packets has been reached, remove the oldest one. 
        if (resultQueue.size() == MAX_PACKETS) {
            resultQueue.removeLast();
        } 
        // Add the new packet. 
        resultQueue.addFirst(packet);
        // Notify waiting threads a result is available. 
        notifyAll();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:isEmpty, removeLast
listener.onOutput(event);
    } 
 
    private void onComplete(ProgressCompleteEvent progressCompleteEvent) {
        assert !operations.isEmpty();
        Operation operation = operations.removeLast();
        operation.status = progressCompleteEvent.getStatus();
        operation.completeTime = progressCompleteEvent.getTimestamp();
        operation.complete();
    } 
 
    private void onStart(ProgressStartEvent progressStartEvent) {
        Operation operation = new Operation(progressStartEvent.getCategory(), progressStartEvent.getLoggingHeader(), progressStartEvent.getTimestamp());
        operations.add(operation);
 
        if (!deferHeader || !(progressStartEvent.getLoggingHeader() != null && progressStartEvent.getLoggingHeader().equals(progressStartEvent.getShortDescription()))) {
            operation.startHeader();
        } 
    } 
6
CodeRank
This code example shows how to use the following methods:isEmpty, addFirst, remove, removeLast, size
		if (this.maxCacheSize == 0){
			return null; 
		} 
 
		// if the key isn't in the cache and the cache is full... 
		if (!super.containsKey(key) && !this.list.isEmpty() && this.list.size() + 1 > this.maxCacheSize) {
			final KEY deadKey = this.list.removeLast();
			super.remove(deadKey);
		} 
 
		updateKey(key);
		return super.put(key, value);
	} 
 
	/** 
	 * Overrides <code>get()</code> so that it also updates the LRU list. 
	 *  
	 * @param key 
	 *            key with which the expected value is associated 
	 * @return the value to which the cache maps the specified key, or 

6
CodeRank
removeLast Method Overview
Removes and returns the last element from this list.
See Code Examples for other Java 8 LinkedList Methods: