LinkedList poll - 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 poll method.

This code example shows how to use the following methods:isEmpty, poll
    } 
 
    public char poll() { 
        char x = (char) cursor;
        try { 
            if(cache.isEmpty()){
                cursor = reader.read();
            } else { 
                cursor = cache.poll();
            } 
        } catch (IOException e) {
            e.printStackTrace();
        } 
        return x;
    } 
 
    public boolean isEmpty() { 
        return cursor == -1;
    } 
 
6
CodeRank
This code example shows how to use the following methods:poll, size
     * @throws IOException 
     */ 
    public int poll() throws IOException{
        peekindex = 0;
        int v = -1;
        if(cache.size() <= 0){
            v = is.read();
        } else { 
            v = cache.poll();
        } 
        if(v == -1){
            end = true;
        } 
        if(v == '\n'){
            col = 0;
            row ++;
        } else { 
            col ++;
        } 
        return v;
6
CodeRank
This code example shows how to use the following methods:poll, size
    // } 
    // return pos; 
    // } 
 
    private Token stashed() { 
        if (stash.size() > 0) {
            return stash.poll();
        } 
        return null; 
    } 
 
    private Token deferred() { 
        if (deferredTokens.size() > 0) {
            return deferredTokens.poll();
        } 
        return null; 
    } 
 
    private Token eos() { 
        if (scanner.getInput().length() > 0) {
6
CodeRank
This code example shows how to use the following methods:isEmpty, poll
	public DefaultInterceptorStack(InterceptorHandlerFactory handlerFactory) {
		this.handlerFactory = handlerFactory;
	} 
 
	public void next(ResourceMethod method, Object resourceInstance) throws InterceptionException {
		if (interceptors.isEmpty()) {
			logger.debug("All registered interceptors have been called. End of VRaptor Request Execution."); 
			return; 
		} 
		InterceptorHandler handler = interceptors.poll();
		handler.execute(this, method, resourceInstance);
	} 
 
	public void add(Class<? extends Interceptor> type) {
		this.interceptors.addLast(handlerFactory.handlerFor(type));
	} 
 
	//XXX this method will be removed soon 
	public void addAsNext(Class<? extends Interceptor> type) {
		if (!type.getPackage().getName().startsWith("br.com.caelum.vraptor.interceptor") &&
6
CodeRank
This code example shows how to use the following methods:poll, size
     * @throws IOException 
     */ 
    public int poll() throws IOException{
        peekindex = 0;
        int v = -1;
        if(cache.size() <= 0){
            v = is.read();
        } else { 
            v = cache.poll();
        } 
        if(v == -1){
            end = true;
        } 
        if(v == '\n'){
            col = 0;
            row ++;
        } else { 
            col ++;
        } 
        return v;
6
CodeRank
This code example shows how to use the following methods:isEmpty, add, poll
	} 
	 
	public void addItem(File file) {
		if (getCount() >= maxImagesToDisplay){
			bufferFileList.add(file);
		} else if (!bufferFileList.isEmpty()){
			privAddItem(bufferFileList.poll());
			bufferFileList.add(file);
		} else { 
			privAddItem(file);
		} 
	} 
	 
	private void privAddItem(File file) {
		if (!fileList.contains(file)) {
			Viewer.printDebug("Adding image to adapter - " + file.toString());
 
			Options options = new BitmapFactory.Options();
			options.inJustDecodeBounds = true;
 
5
CodeRank
This code example shows how to use the following methods:peek, poll, isEmpty
		} 
	} 
 
	public void endContent( IContent content ) throws BirtException
	{ 
		if ( !unfinishedContents.isEmpty( ) )
		{ 
			IContent c = unfinishedContents.peek( );
			if ( c == content )
			{ 
				unfinishedContents.poll( );
			} 
		} 
	} 
 
	public void startListBand( IListBandContent listBand ) throws BirtException
	{ 
		int bandType = listBand.getBandType( );
		if ( bandType == IBandContent.BAND_HEADER
				|| bandType == IBandContent.BAND_GROUP_HEADER )
4
CodeRank
This code example shows how to use the following methods:poll
        assertEquals("offer() should add an element as the last one", origSize, ll.lastIndexOf(objArray[0]));
    } 
 
    public void test_poll() { 
        assertEquals("should return the head", objArray[0], ll.poll());
        LinkedList list = new LinkedList();
        assertNull("should return 'null' if list is empty", list.poll());
    } 
 
    public void test_remove() { 
        for (int i = 0; i < objArray.length; i++) {
            assertEquals("should remove the head", objArray[i], ll.remove());
        } 
        assertEquals("should be empty", 0, ll.size());
        try { 
            ll.remove();
            fail("NoSuchElementException is expected when removing from the empty list");
        } catch (NoSuchElementException e) {
            //-- expected 
        } 
4
CodeRank
This code example shows how to use the following methods:poll
        this.pageContext.addFirst(pageContext);
    } 
 
    /** Pop the last page context off the stack and return it. */ 
    public PageContext popPageContext() { 
        return pageContext == null ? null : pageContext.poll();
    } 
 
    /** Get the last page context that was pushed onto the stack. */ 
    public PageContext getPageContext() { 
        return pageContext == null ? null : pageContext.peek();
    } 
 
    /** Get the path to the currently executing JSP. */ 
    public String getCurrentPage() {
        return (String) getPageContext().getRequest().getAttribute(
                StripesConstants.REQ_ATTR_INCLUDE_PATH); 
    } 
 
    /** 
4
CodeRank
poll Method Overview
Retrieves and removes the head (first element) of this list.
See Code Examples for other Java 8 LinkedList Methods: