You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gary Gregory <gg...@seagullsw.com> on 2003/10/08 20:56:25 UTC
[lang] ArrayUtils.reverse
Hello,
How about returning the argument instead of void for these APIs such that
they can be used in expressions?
Now ArrayUtils:
public static void reverse(final Object[] array) {
Proposal:
public static Object[] reverse(final Object[] array) {
I ran into this with the Object[] version of the API but this applies to all
other ArrayUtils.reverse APIs.
This change should backwards compatible with a recompile of client code.
Thanks,
Gary
Re: [lang] ArrayUtils.reverse
Posted by __matthewHawthorne <ma...@phreaker.net>.
I think it's a good idea, but I like method that returns void also,
because it may save memory by modifying the input array.
Maybe your suggested method should be renamed to:
Object[] copyReverse(final Object[] array)
and be modified to not operate on the argument, but instead create a
copy of it and return the reverse of the copy.
What do you think?
Gary Gregory wrote:
> Hello,
>
> How about returning the argument instead of void for these APIs such that
> they can be used in expressions?
>
> Now ArrayUtils:
>
> public static void reverse(final Object[] array) {
>
> Proposal:
>
> public static Object[] reverse(final Object[] array) {
>
>
> I ran into this with the Object[] version of the API but this applies to all
> other ArrayUtils.reverse APIs.
>
> This change should backwards compatible with a recompile of client code.
>
> Thanks,
> Gary
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org