@Override
	@SuppressWarnings("unchecked") // unchecked cast
	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++) {
			Long value = longs[i];
			a[i] = (T)value;
		}
        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