[ 
https://issues.apache.org/jira/browse/LANG-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17755999#comment-17755999
 ] 

Gary D. Gregory commented on LANG-1707:
---------------------------------------

Maybe, but the implementation should allocate a single array, not a temporary 
array for each input element.

> Syntactic suger to concatenate arrays
> -------------------------------------
>
>                 Key: LANG-1707
>                 URL: https://issues.apache.org/jira/browse/LANG-1707
>             Project: Commons Lang
>          Issue Type: Wish
>          Components: lang.*
>    Affects Versions: 3.13.0
>            Reporter: Gilles Sadowski
>            Priority: Trivial
>              Labels: suggestion
>             Fix For: 3.14.0
>
>
> In {{ArrayUtils}}, a method such as {{addAll(T[], T ... others)}} makes it 
> easy to concatenate two arrays.
> Then, one can concatenate several arrays:
> {code}
>     /** 
>      * @param <T> Type. 
>      * @param arrays Arrays. 
>      * @return an array that contains all the elements in the input arrays. 
>      */
>     private static <T> T[] concat(T[] ... arrays) {
>         final int numArr = arrays.length;
>         T[] concatenated = null;
>         for (int i = numArr; i > 0; i--) {
>             concatenated = ArrayUtils.addAll(arrays[i - 1], concatenated);
>         }
>         return concatenated;
>     }
> {code}
> Shouldn't {{concat(T[] ...)}} be part of {{ArrayUtils}}?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to