ijuma commented on a change in pull request #9949:
URL: https://github.com/apache/kafka/pull/9949#discussion_r563175967



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/LeaderAndIsrRequest.java
##########
@@ -183,8 +182,7 @@ public long brokerEpoch() {
 
     public Iterable<LeaderAndIsrPartitionState> partitionStates() {
         if (version() >= 2)
-            return () -> new FlattenedIterator<>(data.topicStates().iterator(),
-                topicState -> topicState.partitionStates().iterator());
+            return () -> data.topicStates().stream().flatMap(topicState -> 
topicState.partitionStates().stream()).iterator();

Review comment:
       We should be generally careful about replacing simple code paths with 
more complex ones in Kafka. Kafka is a high performance system, so code 
readability is one factor, but not the only one.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to