Code example for BlockingQueue

Methods: drainTo

0
        return capacity - size.get();
    } 
 
    @Override 
    public int drainTo(Collection<? super E> c) {
        int v = queue.drainTo(c);
        size.addAndGet(-v);
        return v;
    } 
 
    @Override 
    public int drainTo(Collection<? super E> c, int maxElements) {
        int v = queue.drainTo(c, maxElements);
        size.addAndGet(-v);
        return v;
    } 
 
    @Override 
    public Object[] toArray() {
        return queue.toArray();
    }