You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "divijvaidya (via GitHub)" <gi...@apache.org> on 2023/02/07 15:22:19 UTC

[GitHub] [kafka] divijvaidya commented on a diff in pull request #13212: MINOR: Remove accidental unnecessary code; fix comment references; use bulk operations

divijvaidya commented on code in PR #13212:
URL: https://github.com/apache/kafka/pull/13212#discussion_r1098802862


##########
clients/src/main/java/org/apache/kafka/clients/admin/AlterClientQuotasOptions.java:
##########
@@ -19,6 +19,8 @@
 
 import org.apache.kafka.common.annotation.InterfaceStability;
 
+import java.util.Collection;

Review Comment:
   where are we using this in this file?
   
   (same for other imports)



##########
clients/src/main/java/org/apache/kafka/common/utils/Utils.java:
##########
@@ -779,8 +779,7 @@ public static ByteBuffer ensureCapacity(ByteBuffer existingBuffer, int newLength
     @SafeVarargs
     public static <T> Set<T> mkSet(T... elems) {
         Set<T> result = new HashSet<>((int) (elems.length / 0.75) + 1);
-        for (T elem : elems)
-            result.add(elem);
+        result.addAll(Arrays.asList(elems));

Review Comment:
   we are creating an intermediate data structure (list) here in the new code. It might not be worth it.
   
   (same for other places where we use Arrays.asList)



-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org