yunchipang commented on code in PR #20372:
URL: https://github.com/apache/kafka/pull/20372#discussion_r2292283432


##########
tools/src/main/java/org/apache/kafka/tools/LogCompactionTester.java:
##########
@@ -246,9 +248,9 @@ public static void main(String[] args) throws Exception {
         int sleepSecs = optionSet.valueOf(options.sleepSecsOpt);
 
         long testId = RANDOM.nextLong();
-        String[] topics = IntStream.range(0, topicCount)
+        Set<String> topics = IntStream.range(0, topicCount)
                 .mapToObj(i -> "log-cleaner-test-" + testId + "-" + i)
-                .toArray(String[]::new);
+                .collect(toCollection(LinkedHashSet::new));

Review Comment:
   @m1a2st thanks for the review! I totally agree with `List` would be more 
convenient for indexed access, but `Set` is preferred here because
   1. semantic clarity: `topics` represents a collection of unique topic names
   2. duplicate prevention: `Set` protects against duplicate topics by accident



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