/** * Returns the elements in an array. * * @return an array containing all set elements. */ @Override public Object[] toArray() { return isSizeKnown() ? super.toArray() : toArray(new Object[32], true); }
/** * Returns the elements in the given array, or in a new array of the same type * if it was necessary to allocate more space. * * @param <T> the type array elements. * @param array where to store the elements. * @return an array containing all set elements. */ @Override @SuppressWarnings("SuspiciousToArrayCall") public <T> T[] toArray(final T[] array) { return isSizeKnown() ? super.toArray(array) : toArray(array, false); }
/** * Returns the elements in an array. * * @return an array containing all set elements. */ @Override public Object[] toArray() { return isSizeKnown() ? super.toArray() : toArray(iterator(), new Object[32], true); }
/** * Returns the elements in an array. * * @return an array containing all list elements. */ @Override public Object[] toArray() { return sizeIfKnown() >= 0 ? super.toArray() : SetOfUnknownSize.toArray(iterator(), new Object[32], true); }
/** * Returns the elements in the given array, or in a new array of the same type * if it was necessary to allocate more space. * * @param <T> the type array elements. * @param array where to store the elements. * @return an array containing all set elements. */ @Override @SuppressWarnings("SuspiciousToArrayCall") public <T> T[] toArray(final T[] array) { return isSizeKnown() ? super.toArray(array) : toArray(iterator(), array, false); }
/** * Returns the elements in the given array, or in a new array of the same type * if it was necessary to allocate more space. * * @param <T> the type array elements. * @param array where to store the elements. * @return an array containing all list elements. */ @Override @SuppressWarnings("SuspiciousToArrayCall") public <T> T[] toArray(final T[] array) { return sizeIfKnown() >= 0 ? super.toArray(array) : SetOfUnknownSize.toArray(iterator(), array, false); }