@Override public int[] toArray() { return performOperation( TerminalFunctions.toArrayIntFunction(), false, (v1, v2) -> { int[] array = Arrays.copyOf(v1, v1.length + v2.length); System.arraycopy(v2, 0, array, v1.length, v2.length); return array; }, null, false); }
/** * Creates a Array of the given elements. * * @param <T> Component type of the Array. * @param elements Zero or more elements. * @return A Array containing the given elements in the same order. * @throws NullPointerException if {@code elements} is null */ @SuppressWarnings("varargs") @SafeVarargs public static <T> Array<T> of(T... elements) { Objects.requireNonNull(elements, "elements is null"); return wrap(Arrays.copyOf(elements, elements.length)); }