ijuma commented on code in PR #14529:
URL: https://github.com/apache/kafka/pull/14529#discussion_r1356894691


##########
clients/src/main/java/org/apache/kafka/common/record/Records.java:
##########
@@ -70,6 +71,13 @@ public interface Records extends TransferableRecords {
      */
     AbstractIterator<? extends RecordBatch> batchIterator();
 
+    /**
+     * Return the last record batch if non-empty or an empty `Optional` 
otherwise.
+     *
+     * Note that this requires iterating over all the record batches and hence 
it's expensive.
+     */
+    Optional<RecordBatch> lastBatch();

Review Comment:
   I don't see how it helps to only have it in `AbstractRecords`, the point is 
to encapsulate the implementation since the equivalent Java code is a lot more 
verbose than the Scala version.



-- 
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

Reply via email to