public <A> A[] toArray(final IntFunction<A[]> generator) {
		final A[] result = generator.apply(_size);
		copyTo(result);
		return result;
	}
Return a snapshot of the current buffer content.

@param generator a function which produces a new array of the desired
       type and the provided length
@param <A> the element type of the resulting array
@return the buffer snapshot
@throws ArrayStoreException if an element in the {@code value} array
        could not be stored into the dest array because of a type mismatch
@throws NullPointerException if the given {@code generator} is {@code null}
jenetics/src/main/java/io/jenetics/util/Buffer.java