[ 
https://issues.apache.org/jira/browse/KAFKA-8955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17087733#comment-17087733
 ] 

ASF GitHub Bot commented on KAFKA-8955:
---------------------------------------

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



##########
File path: 
clients/src/main/java/org/apache/kafka/common/requests/AlterPartitionReassignmentsResponse.java
##########
@@ -66,14 +64,13 @@ public int throttleTimeMs() {
     public Map<Errors, Integer> errorCounts() {
         Map<Errors, Integer> counts = new HashMap<>();
         Errors topLevelErr = Errors.forCode(data.errorCode());
-        counts.put(topLevelErr, counts.getOrDefault(topLevelErr, 0) + 1);
+        updateErrorCounts(counts, topLevelErr);
 
-        for (ReassignableTopicResponse topicResponse : data.responses()) {
-            for (ReassignablePartitionResponse partitionResponse : 
topicResponse.partitions()) {
-                Errors error = Errors.forCode(partitionResponse.errorCode());
-                counts.put(error, counts.getOrDefault(error, 0) + 1);
-            }
-        }
+        data.responses().forEach(topicResponse ->
+                topicResponse.partitions().forEach(partitionResponse ->
+                updateErrorCounts(counts, 
Errors.forCode(partitionResponse.errorCode()))

Review comment:
       Indenting seems wrong?




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


> Add an AbstractResponse#errorCounts method that takes a stream or iterable
> --------------------------------------------------------------------------
>
>                 Key: KAFKA-8955
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8955
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Colin McCabe
>            Assignee: Tom Bentley
>            Priority: Minor
>
> We should have an AbstractResponse#errorCounts method that takes a stream or 
> iterable.  This would allow us to avoid copying data in many cases.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to