@Override
    public <A> A[] toArray(IntFunction<A[]> generator) {
        return inner.toArray(generator);
    }
Returns an array containing the elements of this stream, using the
provided {@code generator} function to allocate the returned array, as
well as any additional arrays that might be required for a partitioned
execution or for resizing.
<p>
This is a terminal operation.

<p>
The generator function takes an integer, which is the size of the
desired array, and produces an array of the desired size.  This can be
concisely expressed with an array constructor reference:
<pre>{@code
    Person[] men = people.stream()
                         .filter(p -> p.getGender() == MALE)
                         .toArray(Person[]::new);
}</pre>

@param <A>        the element type of the resulting array
@param generator  a function which produces a new array of the desired
                  type and the provided length
@return           an array containing the elements in this stream
@throws           ArrayStoreException if the runtime type of the array 
                  returned from the array generator is not a supertype of 
                  the runtime type of every element in this stream
@throws           NullPointerException if any of the provided parameters are {@code null}
common-parent/mapstream/src/main/java/com/speedment/common/mapstream/MapStream.java