private void ensureCapacityHelper(int minCapacity){
  int oldCapacity=elementData.length;
  if (minCapacity > oldCapacity) {
    Object[] oldData=elementData;
    int newCapacity=(capacityIncrement > 0) ? (oldCapacity + capacityIncrement) : (oldCapacity * 2);
    if (newCapacity < minCapacity) {
      newCapacity=minCapacity;
    }
    elementData=new Object[newCapacity];
    System.arraycopy(oldData,0,elementData,0,elementCount);
  }
}

private void ensureCapacityHelper ( int minCapacity ) { int oldCapacity = elementData . length ; if ( minCapacity > oldCapacity ) { Object [ ] oldData = elementData ; int newCapacity = ( capacityIncrement > 0 ) ? ( oldCapacity + capacityIncrement ) : ( oldCapacity * 2 ) ; if ( newCapacity < minCapacity ) { newCapacity = minCapacity ; } elementData = new Object [ newCapacity ] ; System . arraycopy ( oldData , 0 , elementData , 0 , elementCount ) ; } }
this implements the unsynchronized semantics of ensurecapacity . synchronized methods in this class can internally call this method for ensuring capacity without incurring the cost of an extra synchronization .
