code: private static <T> Iterable<List<T>> partitionExponentially(List<T> values, int minBatchSize, int maxBatchSize)
      {
          return () -> new AbstractIterator<List<T>>()
          {
              private int currentSize = minBatchSize;
              private final Iterator<T> iterator = values.iterator();
  
              @Override
              protected List<T> computeNext()
              {
                  if (!iterator.hasNext()) {
                      return endOfData();
                  }
  
                  int count = 0;
                  ImmutableList.Builder<T> builder = ImmutableList.builder();
                  while (iterator.hasNext() && count < currentSize) {
                      builder.add(iterator.next());
                      ++count;
                  }
  
                  currentSize = min(maxBatchSize, currentSize * 2);
                  return builder.build();
              }
          };
      }
docs: Partition the given list in exponentially (power of 2) increasing batch sizes starting at 1 up to maxBatchSize