kirktrue commented on code in PR #19917: URL: https://github.com/apache/kafka/pull/19917#discussion_r2150887174
########## clients/src/main/java/org/apache/kafka/clients/consumer/internals/AbstractFetch.java: ########## @@ -470,7 +475,19 @@ protected Map<Node, FetchSessionHandler.FetchRequestData> prepareFetchRequests() } } - return fetchable.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue().build())); + return convert(fetchable); + } + + private Map<Node, FetchSessionHandler.FetchRequestData> convert(Map<Node, FetchSessionHandler.Builder> fetchable) { + Map<Node, FetchSessionHandler.FetchRequestData> map = new HashMap<>(fetchable.size()); + + for (Map.Entry<Node, FetchSessionHandler.Builder> entry : fetchable.entrySet()) { + Node node = entry.getKey(); + FetchSessionHandler.FetchRequestData fetchRequestData = entry.getValue().build(); + map.put(node, fetchRequestData); Review Comment: This was just to make the code a little clearer about the exact processing and types in use. I'll make it more succinct. -- 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