private int nextBatchSize() {
        int batchSize;
        if (batchSizeIndex >= batchSizes.length) {
            batchSize = batchSizes[batchSizes.length - 1];
        } else {
            batchSize = batchSizes[batchSizeIndex++];
        }

        if (batchSize > sizeEstimate) {
            batchSize = (int) sizeEstimate;
        }
        if (batchSize > MAX_BATCH) {
            batchSize = MAX_BATCH;
        }
        return batchSize;
    }
Creates a {@link Spliterator} using the given iterator for traversal, and
reporting the given characteristics. The size is unknown.

@param iterator the iterator for the source
@param characteristics properties of this {@link Spliterator}'s source or
elements.
@param batchSizes the batch sizes to use for pseudo parallelism
runtime-parent/runtime-core/src/main/java/com/speedment/runtime/core/internal/stream/parallel/ConfigurableIteratorSpliteratorImpl.java