Code example for AtomicInteger

Methods: get

     * Returns the number of elements in this queue. 
     * @return the number of elements in this queue 
    public int size() { 
        return count.get();
    // this doc comment is a modified copy of the inherited doc comment, 
    // without the reference to unlimited queues. 
     * Returns the number of additional elements that this queue can ideally 
     * (in the absence of memory or resource constraints) accept without 
     * blocking. This is always equal to the initial capacity of this queue 
     * less the current {@code size} of this queue. 
     * <p>Note that you <em>cannot</em> always tell if an attempt to insert 
     * an element will succeed by inspecting {@code remainingCapacity} 
     * because it may be the case that another thread is about to 
     * insert or remove an element.