You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Ash <eq...@hotmail.com> on 2003/11/25 01:00:53 UTC

[lang][PATCH] ArrayUtil.subarray(Object, startIndex, endIndex) implementation v 1.0

PFE a first implementation of the proposed
ArrayUtil.subarray()    implemented to take an Object array.
Also encl some basic testcases.
This is my first contribution, so I might take a while to get used to the
some of the procedures of the group.
Waiting for feedback and criticism.
Thanks,
Ashwin





Re: [lang][PATCH] ArrayUtil.subarray(Object, startIndex, endIndex) implementation v 1.0

Posted by Stephen Colebourne <sc...@btopenworld.com>.
Some comments:
1) You should try to match the style of the surrounding code. For your
submission this means spaces after if and for, brackets around the if
statements, and brackets at the end of lines. In many cases I just use
eclipse to reformat new code, but the missing if statement brackets would
require manual intervention.

2) The array copy should be done using System.arraycopy, unless you can
demonstrate the this is faster.

3) The edge case of startIndex == endIndex is not handled to return
EMPTY_OBJECT_ARRAY

4) The parameter names would be better as startIndexInclusive and
endIndexExclusive.

5) The startIndex comment is innacurate re overvalue

6) I think that the startIndex to 0 and endIndex to end tests should
probably go before the EMPTY tests.

7) The submission was via a whole file, rather than a patch. See
http://jakarta.apache.org/commons/patches.html

8) Tests look good, although I would like to see some
assertSame(EMPTY_OBJECT_ARRAY, ...) to test that the constant is returned in
the relevant cases.

This seems like a long list, but hopefully you will learn some of our ways
through it. Please submit a patch either to the list or bugzilla if you can
;-)

Stephen

----- Original Message -----
From: "Ash" <eq...@hotmail.com>
> PFE a first implementation of the proposed
> ArrayUtil.subarray()    implemented to take an Object array.
> Also encl some basic testcases.
> This is my first contribution, so I might take a while to get used to the
> some of the procedures of the group.
> Waiting for feedback and criticism.
> Thanks,
> Ashwin
>
>
>
>
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org