commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Digulla (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-660) Add methods to insert arrays into arrays at an index
Date Fri, 26 Aug 2011 08:11:29 GMT

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

Aaron Digulla commented on LANG-660:
------------------------------------

The JDK solves this by making the insert point the first parameter:

{{addAll(int index, int[] array, int...)}}

So I suggest to change {{add(int[], int, int)}}, too. That way, all array/list APIs would
work the same.

Now, you'll argue "backwards compatibility" but a) the change is easy to find (the compiler
will show an error), b) easy to fix (swap two parameters) and 3) it's probably not millions
of lines of code that need to be fixed.

So before you create a long-term suffering by creating an incompatible API (and people cursing
over years when they have to mentally switch between the two), think really hard whether this
is a good instance to avoid a one-time suffering.

If you really can't have it, rename the methods to {{insert}}. {{ArrayUtils.insertArray}}
violates DRY.

> Add methods to insert arrays into arrays at an index
> ----------------------------------------------------
>
>                 Key: LANG-660
>                 URL: https://issues.apache.org/jira/browse/LANG-660
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.*
>    Affects Versions: 2.5
>            Reporter: Aaron Digulla
>            Priority: Minor
>             Fix For: 3.0.2
>
>         Attachments: ArrayUtils.txt, ArrayUtilsAddTest.txt, ArrayUtilsAddTest_addAll.patch,
ArrayUtils_addAll.patch
>
>
> Please add methods with this signature: ArrayUtils.addAll(int[] target, int index, int[]
source) (i.e. insert an array into an array at a certain position).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message