public Object[] toArray(){
  Object[] elements=getArray();
  return Arrays.copyOf(elements,elements.length);
}

public Object [ ] toArray ( ) { Object [ ] elements = getArray ( ) ; return Arrays . copyOf ( elements , elements . length ) ; }
returns an array containing all of the elements in this list in proper sequence ( from first to last element ) . < p > the returned array will be " safe " in that no references to it are maintained by this list . ( in other words , this method must allocate a new array ) . the caller is thus free to modify the returned array . < p > this method acts as bridge between array - based and collection - based apis .
