@Override
  public GenerateContentResponse next() {
    GenerateContentResponse nextItem = (GenerateContentResponse) serverStreamIterator.next();
    history.add(nextItem);
    return nextItem;
  }
Iterator of the ResponseStream that holds the response chunks.
java-vertexai/google-cloud-vertexai/src/main/java/com/google/cloud/vertexai/generativeai/ResponseStreamIteratorWithHistory.java