default <B> B[] toArray(final IntFunction<B[]> generator) {
		return toArray(generator.apply(length()));
	}
Returns an array containing the elements of this sequence, using the
provided generator function to allocate the returned array.

@since 4.4

@param generator a function which produces a new array of the desired
       type and the provided length
@param <B> the element type of the resulting array
@return an array containing the elements in {@code this} sequence
@throws ArrayStoreException if the runtime type of the specified array is
        not a super type of the runtime type of every element in this
        array
@throws NullPointerException if the given {@code generator} is {@code null}.
jenetics/src/main/java/io/jenetics/util/Seq.java