public void clear(){
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    Object[] array=queue;
    int n=size;
    size=0;
    for (int i=0; i < n; i++)     array[i]=null;
  }
  finally {
    lock.unlock();
  }
}

public void clear ( ) { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { Object [ ] array = queue ; int n = size ; size = 0 ; for ( int i = 0 ; i < n ; i ++ ) array [ i ] = null ; } finally { lock . unlock ( ) ; } }
atomically removes all of the elements from this queue . the queue will be empty after this call returns .
