@Override
		@SuppressWarnings("unchecked") // unchecked casts
		public <T> T[] toArray(T[] a) {
	        if (a.length < size()) {
	            a = (T[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size());
	        }
			for(int i=0;i<size();i++) {
				a[i] = (T)get(i);
			}
	        if (a.length > size()) {
	            a[size()] = null;
	        }
	        return a;
		}
Doubles the size of the array.
@param size The new capacity of the array.
Ghidra/Framework/Generic/src/main/java/ghidra/util/datastruct/LongArrayList.java