commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <>
Subject Re: [lang] ArrayUtils.isAscending, isDescending
Date Thu, 01 Apr 2004 20:32:52 GMT
Gary Gregory wrote:
> Hmm, I was thinking that /because/ we are talking of primitive arrays
> and not Object arrays, this would make things simpler in the sense that
> a Comparator is not needed. Does simple like isAscending(double[]) fit
> in [lang] and ArrayUtils as opposed to adding something to [primitives]?
> Or is this too much of a math-like query and should stay in math?
> Of course, one could argue, that starting to add isThisOrThat type of
> methods might open the door to other requests that might not belong. 
> In the XP way, I would not be against adding the two is- methods for the
> primitive datatypes [math] needs, no more, no less. In this case we are
> only talking about double?
> I'd like to hear what others have to say.
>>In a few places in [math] we need to verify that double[] array
>>>are sorted.  
> I did not look at the code but I am wondering: what if the array is not
> sorted properly? Does [math] throw an exception, sort the array and
> proceed? 
> Gary 

Currently, we throw IllegalArgumentException, since the arrays in question 
are actual parameters that are supposed to represent partition points and 
if they are not in (strictly) ascending order, the client has misused the API.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message