commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles Sadowski <gil...@harfang.homelinux.org>
Subject Re: [Math] MathUtils.checkOrder
Date Thu, 22 Sep 2011 08:48:48 GMT
Hi.

> 
> I do not understand why a non-monotone collection should throw a
> IllegalArgumentException...? There is nothing wrong with the argument, it
> just is not in corrected order. Wouldn't it be better to return a false?
> 
> We have:
> 
>             if (!ok && abort) {
>                 throw new NonMonotonousSequenceException(val[i], previous,
> i, dir, strict);
>             }
> 
> Why throw this? Why not return false and let the code calling this method
> decide if it wants to throw an exception?

Did you have a look to the various overloads of "checkOrder"?
In the above, if "abort" is "false", no exceptions will be thrown!


Gilles

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


Mime
View raw message