/** * {@inheritDoc} */ public Object[] toArray() { final Object[] arrayCopy = new Object[size]; copyValues(arrayCopy); return arrayCopy; }
/** * {@inheritDoc} */ public Object[] toArray() { final Object[] arrayCopy = new Object[size()]; copyValues(arrayCopy); return arrayCopy; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public <T> T[] toArray(final T[] longo) { final Class<?> componentType = longo.getClass().getComponentType(); if (!componentType.isAssignableFrom(Long.class)) { throw new ArrayStoreException("Cannot store Longs in array of type " + componentType); } @DoNotSub final int size = this.size; final T[] arrayCopy = longo.length >= size ? longo : (T[])Array.newInstance(componentType, size); copyValues(arrayCopy); return arrayCopy; }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public <T> T[] toArray(final T[] longo) { final Class<?> componentType = longo.getClass().getComponentType(); if (!componentType.isAssignableFrom(Long.class)) { throw new ArrayStoreException("cannot store Longs in array of type " + componentType); } @DoNotSub final int size = size(); final T[] arrayCopy = longo.length >= size ? longo : (T[])Array.newInstance(componentType, size); copyValues(arrayCopy); return arrayCopy; }