Code example for AtomicInteger

0
 
    /** The capacity bound, or Integer.MAX_VALUE if none */ 
    private final int capacity;
 
    /** Current number of elements */ 
    private final AtomicInteger count = new AtomicInteger(0);
 
    /** 
     * Head of linked list. 
     * Invariant: head.item == null 
     */ 
    private transient Node<E> head;
 
    /** 
     * Tail of linked list. 
     * Invariant: last.next == null 
     */ 
    private transient Node<E> last;
 
    /** Lock held by take, poll, etc */ 
    private final ReentrantLock takeLock = new ReentrantLock();