public Function<List<T>, List<T>> finisher() {
        return ts -> {
            if (!ts.isEmpty()) {
                batchProcessor.accept(ts);
                recordsProcessed.addAndGet(ts.size());
            }
            return Collections.emptyList();
        };
    }
Creates a new batch collector

@param batchSize      the batch size after which the batchProcessor should be called
@param batchProcessor the batch processor which accepts batches of records to process
@param <T>            the type of elements being processed
@return a batch collector instance
stroom-util/src/main/java/stroom/util/collections/BatchingCollector.java