risdenk commented on code in PR #791:
URL: https://github.com/apache/solr/pull/791#discussion_r996356264


##########
solr/core/src/java/org/apache/solr/util/SolrCLI.java:
##########
@@ -438,16 +459,19 @@ private static Options getToolOptions(Tool tool) {
   }
 
   public static Option[] joinOptions(Option[] lhs, Option[] rhs) {
-    List<Option> options = new ArrayList<Option>();
-    if (lhs != null && lhs.length > 0) {
-      for (Option opt : lhs) options.add(opt);
+    if (lhs == null) {
+      return rhs == null ? new Option[0] : rhs;
     }
 
-    if (rhs != null) {
-      for (Option opt : rhs) options.add(opt);
+    if (rhs == null) {
+      return lhs;
     }
 
-    return options.toArray(new Option[0]);
+    Option[] options = new Option[lhs.length + rhs.length];
+    System.arraycopy(lhs, 0, options, 0, lhs.length);

Review Comment:
   `System.arraycopy` is recommended in a few places by intellij inspections. 
there are some manual array copies throughout the Solr code base that could be 
fixed.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to