ArrayDeque addLast - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:addLast, removeFirst, size
    public void logManagingTrust(int userId, ComponentName agent, boolean managing) {
        addEvent(new Event(TYPE_MANAGING_TRUST, userId, agent, null, 0, false, managing));
    } 
 
    private void addEvent(Event e) {
        if (mEvents.size() >= HISTORY_LIMIT) {
            mEvents.removeFirst();
        } 
        mEvents.addLast(e);
    } 
 
    public void dump(PrintWriter writer, int limit, int userId, String linePrefix,
            boolean duplicateSimpleNames) {
        int count = 0;
        Iterator<Event> iter = mEvents.descendingIterator();
        while (iter.hasNext() && count < limit) {
            Event ev = iter.next();
            if (userId != UserHandle.USER_ALL && userId != ev.userId) {
                continue; 
            } 
7
CodeRank
This code example shows how to use the following methods:addLast, isEmpty, pollFirst
		this.channel.pipeline().fireUserEventTriggered(env);
	} 
 
	@Override 
	public void userEventTriggered(ChannelHandlerContext ctx, Object envelopeToEnqueue) throws Exception {
		boolean triggerWrite = this.queuedEnvelopes.isEmpty();
 
		this.queuedEnvelopes.addLast((Envelope) envelopeToEnqueue);
		this.numQueued.incrementAndGet();
 
		if (triggerWrite) {
			writeAndFlushNextEnvelopeIfPossible(); 
		} 
	} 
 
	@Override 
	public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
		writeAndFlushNextEnvelopeIfPossible(); 
	} 
 

6
CodeRank
This code example shows how to use the following methods:addLast, getLast, peek, size
 
    /** 
     * @tests {@link java.util.ArrayDeque#addLast(Object)} 
     */ 
    public void test_addLast() throws Exception { 
        testQue.addLast(testObjOne);
        assertEquals(1, testQue.size());
        assertEquals(testObjOne, testQue.peek());
        testQue.addLast(testObjOne);
        assertEquals(2, testQue.size());
        assertEquals(testObjOne, testQue.peek());
        testQue.addLast(testObjTwo);
        assertEquals(3, testQue.size());
        assertEquals(testObjOne, testQue.peek());
        assertEquals(testObjTwo, testQue.getLast());
        try { 
            testQue.addLast(null);
            fail("should throw NullPointerException");
        } catch (NullPointerException e) {
            // expected 

5
CodeRank
This code example shows how to use the following methods:addLast, isEmpty, pollFirst
		this.channel.pipeline().fireUserEventTriggered(env);
	} 
 
	@Override 
	public void userEventTriggered(ChannelHandlerContext ctx, Object envelopeToEnqueue) throws Exception {
		boolean triggerWrite = this.queuedEnvelopes.isEmpty();
 
		this.queuedEnvelopes.addLast((Envelope) envelopeToEnqueue);
		this.numQueuedEnvelopes.incrementAndGet();
 
		if (triggerWrite) {
			writeAndFlushNextEnvelopeIfPossible(); 
		} 
	} 
 
	@Override 
	public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception {
		writeAndFlushNextEnvelopeIfPossible(); 
	} 
 

4
CodeRank
This code example shows how to use the following methods:addLast
        mGLRoot.addOnGLIdleListener(this);
    } 
 
    public synchronized void addBgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mBgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    public synchronized void addFgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mFgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    private int upload(GLCanvas canvas, ArrayDeque<UploadedTexture> deque,
            int uploadQuota, boolean isBackground) {
        while (uploadQuota > 0) {
4
CodeRank
This code example shows how to use the following methods:addLast
        mGLRoot.addOnGLIdleListener(this);
    } 
 
    public synchronized void addBgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mBgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    public synchronized void addFgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mFgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    private int upload(GLCanvas canvas, ArrayDeque<UploadedTexture> deque,
            int uploadQuota, boolean isBackground) {
        while (uploadQuota > 0) {
4
CodeRank
This code example shows how to use the following methods:addLast
            mTextures.clear();
        } 
 
        public synchronized void addTexture(TiledTexture t) {
            if (t.isReady()) return;
            mTextures.addLast(t);
 
            if (mIsQueued) return;
            mIsQueued = true;
            mGlRoot.addOnGLIdleListener(this);
        } 
 
        @Override 
        public boolean onGLIdle(GLCanvas canvas, boolean renderRequested) {
            ArrayDeque<TiledTexture> deque = mTextures;
            synchronized (this) {
                long now = SystemClock.uptimeMillis();
                long dueTime = now + UPLOAD_TILE_LIMIT;
                while (now < dueTime && !deque.isEmpty()) {
                    TiledTexture t = deque.peekFirst();
3
CodeRank
This code example shows how to use the following methods:addLast
    public void push(Decision dec) { 
        decision_path.addFirst(dec); 
    } 
 
    public void setDecisionToRefute(Decision dec) { 
        decision_path.addLast(dec); 
    } 
 
 
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
    //                          Decision<IntVar> services                                                             // 
    //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
 
    @Override 
    public IntVar getDecisionVariable() { 
        throw new UnsupportedOperationException(); 
    } 
 
    @Override 
    public Integer getDecisionValue() { 
3
CodeRank
This code example shows how to use the following methods:addLast
        mGLRoot.addOnGLIdleListener(this);
    } 
 
    public synchronized void addBgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mBgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    public synchronized void addFgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mFgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    private int upload(GLCanvas canvas, ArrayDeque<UploadedTexture> deque,
            int uploadQuota, boolean isBackground) {
        while (uploadQuota > 0) {
4
CodeRank
This code example shows how to use the following methods:addLast
        mGLRoot.addOnGLIdleListener(this);
    } 
 
    public synchronized void addBgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mBgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    public synchronized void addFgTexture(UploadedTexture t) {
        if (t.isContentValid()) return;
        mFgTextures.addLast(t);
        t.setIsUploading(true);
        queueSelfIfNeed(); 
    } 
 
    private int upload(GLCanvas canvas, ArrayDeque<UploadedTexture> deque,
            int uploadQuota, boolean isBackground) {
        while (uploadQuota > 0) {
4
CodeRank
addLast Method Overview
Inserts the specified element at the end of this deque.
See Code Examples for other Java 8 ArrayDeque Methods: