private <T>Stream<Collection<T>> partitionedStream(Iterator<T> iterator){
  return StreamSupport.stream(Spliterators.spliteratorUnknownSize(Iterators.partition(iterator,batchSize),Spliterator.ORDERED),false);
}

private < T > Stream < Collection < T > > partitionedStream ( Iterator < T > iterator ) { return StreamSupport . stream ( Spliterators . spliteratorUnknownSize ( Iterators . partition ( iterator , batchSize ) , Spliterator . ORDERED ) , false ) ; }
partition a stream into a stream of collections , each with batchsize elements .
