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

This code example shows how to use the following methods:size
    /** 
     * pops the active object, which means that the parent object becomes active 
     * @return returns itself so you can chain 
     */ 
    public BasicDBObjectBuilder pop(){ 
        if ( _stack.size() <= 1 )
            throw new IllegalArgumentException( "can't pop last element" );
        _stack.removeLast();
        return this;
    } 
 
    /** 
     * gets the base object 
     * @return The base object 
     */ 
    public DBObject get(){ 
        return _stack.getFirst();
    } 
 
    /** 
10
CodeRank
This code example shows how to use the following methods:size
    } 
 
    public void processEventQueue() { 
        MotionEvent event = mEventQueue.poll();
        while(event != null) {
            processEvent(event);
            event = mEventQueue.poll();
        } 
    } 
 
    public void clearEventQueue() { 
        mEventQueue.clear();
    } 
 
    @Override 
    public boolean onTouchEvent(MotionEvent event) {
        if (mController.onTouchEvent(event)) {
            addToEventQueue(event);
            return true; 
        } 
9
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:size
        pathChangeListener = l;
    } 
 
    /** @return the most recently added point. */ 
    public Point getLastPoint() {
        return (points.size() <= 0) ? null : points.getLast();
    } 
     
    /** @return immutable list of points. */ 
    public List<Point> getPoints() { return safePoints; }
 
    /** 
     * @param x point horizontal coordinate. 
     * @param y point vertical coordinate. 
     * @param color point color. 
     * @param diameter point size. 
      */ 
    public void addPoint(float x, float y, int color, int diameter) {
        points.add(new Point(x, y, color, diameter));
        notifyListener(); 
9
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 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:removeFirst, size
	} 
 
	public short readUnsignedByte() { 
		short res = 0;
 
		if (bytes.size() == 0)
			return res;
 
		res += (short) (bytes.removeFirst() + Byte.MAX_VALUE);
 
		return res;
	} 
 
	public int readUnsignedShort() { 
		int res = 0;
 
		if (bytes.size() == 0)
			return res;
 
		res += readUnsignedByte();
7
CodeRank
This code example shows how to use the following methods:addLast, remove, removeFirst, size
    if (v == null) {
      return null; 
    } 
 
    // update position (tail of list is most recently used) 
    boolean ok = fifo.remove(key);
    assert (ok);
    fifo.addLast(key);
    return v;
  } 
 
  /** 
   * update lru cache, and return evicted or old value. Returns null otherwise. 
   */ 
  public V insert(K key, V val) {
    if (key == null || val == null) {
      return null; 
    } 
 
    V v0 = lookup(key); // updates position

7
CodeRank
This code example shows how to use the following methods:size
	 * called. 
	 */ 
	protected void executeProtected() throws RippleException 
	{ 
//System.out.println( "[" + this + "].executeProtected()" ); 
		while ( queue.size() > 0 ) 
		{ 
			Task task = queue.removeFirst(); 
			Scheduler.add( task ); 
			task.waitUntilFinished(); 
		} 
//System.out.println( "    done." ); 
	} 
 
	protected void stopProtected() 
	{ 
//System.out.println( "stopping all tasks currently executing: " + this ); 
	} 
} 
 
9
CodeRank
This code example shows how to use the following methods:addLast, removeFirst, size
        final LinkedList<Long[]> snapshotList = new LinkedList<Long[]>();
 
        timer.scheduleAtFixedRate(new TimerTask() {
            @Override 
            public void run() { 
                snapshotList.addLast(statsBenchmark.createSnapshot());
                if (snapshotList.size() > 10) {
                    snapshotList.removeFirst();
                } 
            } 
        }, 1000, 1000); 
 
        timer.scheduleAtFixedRate(new TimerTask() {
            private void printStats() { 
                if (snapshotList.size() >= 10) {
                    Long[] begin = snapshotList.getFirst();
                    Long[] end = snapshotList.getLast();
 
                    final long sendTps =
                            (long) (((end[3] - begin[3]) / (double) (end[0] - begin[0])) * 1000L);
7
CodeRank
size Method Overview
Returns the number of elements in this list.
See Code Examples for other Java 8 LinkedList Methods: