mjsax commented on code in PR #20665:
URL: https://github.com/apache/kafka/pull/20665#discussion_r2415245426


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamTask.java:
##########
@@ -505,12 +497,12 @@ private Map<TopicPartition, OffsetAndMetadata> 
committableOffsetsAndMetadata() {
                 // input partitions
                 final Set<TopicPartition> partitionsNeedCommit = 
processorContext.processorMetadata().needsCommit() ?
                     inputPartitions() : consumedOffsets.keySet();
-                committableOffsets = new 
HashMap<>(partitionsNeedCommit.size());
 
-                for (final TopicPartition partition : partitionsNeedCommit) {
-                    committableOffsets.put(partition, 
findOffsetAndMetadata(partition));
-                }
-                break;
+                return partitionsNeedCommit.stream()
+                        .flatMap(partition -> findOffsetAndMetadata(partition)

Review Comment:
   Subjective. :) If would it personally find easy to read using 
`filter(...).map(...)`; it's more explicit, and less "magic"



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to