public E remove(int index){
  final ReentrantLock lock=this.lock;
  lock.lock();
  try {
    Object[] elements=getArray();
    int len=elements.length;
    E oldValue=get(elements,index);
    int numMoved=len - index - 1;
    if (numMoved == 0)     setArray(Arrays.copyOf(elements,len - 1));
 else {
      Object[] newElements=new Object[len - 1];
      System.arraycopy(elements,0,newElements,0,index);
      System.arraycopy(elements,index + 1,newElements,index,numMoved);
      setArray(newElements);
    }
    return oldValue;
  }
  finally {
    lock.unlock();
  }
}

public E remove ( int index ) { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { Object [ ] elements = getArray ( ) ; int len = elements . length ; E oldValue = get ( elements , index ) ; int numMoved = len - index - 1 ; if ( numMoved == 0 ) setArray ( Arrays . copyOf ( elements , len - 1 ) ) ; else { Object [ ] newElements = new Object [ len - 1 ] ; System . arraycopy ( elements , 0 , newElements , 0 , index ) ; System . arraycopy ( elements , index + 1 , newElements , index , numMoved ) ; setArray ( newElements ) ; } return oldValue ; } finally { lock . unlock ( ) ; } }
removes the element at the specified position in this list . shifts any subsequent elements to the left ( subtracts one from their indices ) . returns the element that was removed from the list .
