ijuma commented on code in PR #14529: URL: https://github.com/apache/kafka/pull/14529#discussion_r1356896786
########## clients/src/main/java/org/apache/kafka/common/record/AbstractRecords.java: ########## @@ -44,6 +45,17 @@ public RecordBatch firstBatch() { return iterator.next(); } + @Override + public Optional<RecordBatch> lastBatch() { + Iterator<? extends RecordBatch> iterator = batches().iterator(); + + RecordBatch batch = null; + while (iterator.hasNext()) + batch = iterator.next(); + + return Optional.ofNullable(batch); Review Comment: I don't follow the question. `Optional.ofNullable` converts `null` to `Optional.empty`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org