daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class ArrayList<E> ....{
  2.     public <T> T[] toArray(T[] a){
  3.         if(a.length < size)
  4.             return (T[]) Arrays.copyof(elementData, size, a.getClass());
  5.         System.arraycopy(elementData, 0, a, 0, size);
  6.         if(a.length > size)
  7.             a[size] = null;
  8.         return a;
  9.     }    
  10. }
  11.    
  12. public E[] toArray(E[] a){
  13.       if(a.length < size)
  14.              return (E[]) Arrays.copyof(elementData, size, a.getClass());
  15.       System.arraycopy(elementData, 0, a, 0, size);
  16.       if(a.length > size)
  17.             a[size] = null;
  18.       return a;
  19. }
  20.    
  21. public E[] toArray(E[] a)
  22.    
  23. public <T super E> T[] toArray(T[] a)
  24.    
  25. <T super E>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top