@Override
  public List<T> get() {
    final T firstItem = input.get();
    if (firstItem == null) {
      // Contract of get is to explicitly return null when no more items are available.
      // An empty list is not a suitable thing to return here.
      return null;
    }
    final List<T> batch = new ArrayList<>();
    batch.add(firstItem);
    Integer remainingData = stopBatchCondition.apply(batch);
    while (remainingData > 0
        && (batch.size() + remainingData) <= maximumBatchSize
        && input.hasMore()) {
      if (input.drainTo(batch, remainingData) == 0) {
        break;
      }
      remainingData = stopBatchCondition.apply(batch);
    }
    batchCounter.inc();
    return batch;
  }
Instantiates a new Batching read pipe.

@param input the input
@param maximumBatchSize the maximum batch size
@param batchCounter the batch counter
@param batchEndCondition the batch end condition
services/pipeline/src/main/java/org/hyperledger/besu/services/pipeline/BatchingReadPipe.java