lbradstreet commented on code in PR #20061:
URL: https://github.com/apache/kafka/pull/20061#discussion_r2188849711


##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/ModernGroup.java:
##########
@@ -367,18 +366,15 @@ public void setMetadataHash(long metadataHash) {
     public static long computeMetadataHash(
         Map<String, SubscriptionCount> subscribedTopicNames,
         Map<String, Long> topicHashCache,
-        MetadataImage metadataImage
+        CoordinatorMetadataImage metadataImage
     ) {
         Map<String, Long> topicHash = new 
HashMap<>(subscribedTopicNames.size());
-        subscribedTopicNames.keySet().forEach(topicName -> {
-            TopicImage topicImage = metadataImage.topics().getTopic(topicName);
-            if (topicImage != null) {
+        subscribedTopicNames.keySet().forEach(topicName ->

Review Comment:
   Now that we've added the ifPresent in there I'd suggest writing it fully in 
streams, e.g.
   
   ```
           Map<String, Long> topicHash = subscribedTopicNames.keySet().stream()
                   .filter(topicName -> 
metadataImage.topicMetadata(topicName).isPresent())
                   .collect(Collectors.toMap(
                           topicName -> topicName,
                           topicName -> 
topicHashCache.computeIfAbsent(topicName, k -> Utils.computeTopicHash(k, 
metadataImage))));
   ```



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