alaahong commented on code in PR #668:
URL: https://github.com/apache/fesod/pull/668#discussion_r2484366568


##########
fesod/src/main/java/org/apache/fesod/excel/metadata/AbstractParameterBuilder.java:
##########
@@ -39,10 +41,23 @@ public abstract class AbstractParameterBuilder<T extends 
AbstractParameterBuilde
      * @return
      */
     public T head(List<List<String>> head) {
-        parameter().setHead(head);
+        parameter().setHead(toMutableListIfNecessary(head));
         return self();
     }
 
+    /**
+     * Ensures and returns a fully mutable deep copy of head list.
+     *
+     * @param head head The source list to create a mutable copy from.
+     * @return A new, fully mutable deep copy, or the original list if the 
input is null or empty.
+     */
+    private List<List<String>> toMutableListIfNecessary(List<List<String>> 
head) {
+        if (null == head || head.isEmpty()) {
+            return head;
+        }
+        return head.stream().map(ArrayList::new).collect(Collectors.toList());

Review Comment:
   why not directly new ArrayList as no any map or reduce required?



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