@Override @SuppressWarnings("unchecked") public synchronized <T>T[] toArray(T[] contents){
  if (elementCount > contents.length) {
    return null;
  }
  System.arraycopy(elementData,0,contents,0,elementCount);
  if (elementCount < contents.length) {
    contents[elementCount]=null;
  }
  return contents;
}

@ Override @ SuppressWarnings ( "unchecked" ) public synchronized < T > T [ ] toArray ( T [ ] contents ) { if ( elementCount > contents . length ) { return null ; } System . arraycopy ( elementData , 0 , contents , 0 , elementCount ) ; if ( elementCount < contents . length ) { contents [ elementCount ] = null ; } return contents ; }
returns an array containing all elements contained in this vector . if the specified array is large enough to hold the elements , the specified array is used , otherwise an array of the same type is created . if the specified array is used and is larger than this vector , the array element following the collection elements is set to null .
