@Override public <T>T[] toArray(T[] array){
  return newArray(array);
}

@ Override public < T > T [ ] toArray ( T [ ] array ) { return newArray ( array ) ; }
returns all the elements in an array , and the type of the result array is the type of the argument array . if the argument array is big enough , the elements from the queue will be stored in it ( element immediately following the end of the queue is set to null , if any ) ; otherwise , it will return a new array with the size of the argument array and size of the queue .
