rondagostino commented on code in PR #13280:
URL: https://github.com/apache/kafka/pull/13280#discussion_r1114679640


##########
metadata/src/main/java/org/apache/kafka/image/TopicsImage.java:
##########
@@ -76,8 +84,8 @@ public TopicImage getTopic(String name) {
     }
 
     public void write(ImageWriter writer, ImageWriterOptions options) {
-        for (TopicImage topicImage : topicsById.values()) {
-            topicImage.write(writer, options);
+        for (Map.Entry<Uuid, TopicImage> entry : topicsById.entrySet()) {
+            entry.getValue().write(writer, options);

Review Comment:
   We could, but it is marked deprecated in the library because there is no way 
to provide a reasonable `.equals()` method.  I actually checked, and indeed it 
is true:
   ```
       @Test
       public void testMapValuesEquality() {
           Map<String, String> m = new HashMap<>();
           m.put("a", "a");
           m.put("b", "b");
           assertEquals(m.keySet(), new HashSet<>(Arrays.asList("a", "b")));
           assertEquals(m.keySet(), new HashSet<>(Arrays.asList("b", "a")));
           // note that these all assert inequality
           assertNotEquals(m.values(), new HashSet<>(Arrays.asList("a", "b")));
           assertNotEquals(m.values(), Arrays.asList("a", "b"));
           assertNotEquals(m.values(), new HashSet<>(Arrays.asList("b", "a")));
           assertNotEquals(m.values(), Arrays.asList("b", "a"));
       }
   ```
   



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