commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <Luc.Maison...@free.fr>
Subject Re: [math] remove null check when using entry iterator in [Array]RealVector
Date Thu, 03 May 2012 19:04:11 GMT
Le 03/05/2012 16:07, Thomas Neidhart a écrit :
> Hi,

Hi Thomas,

> 
> I have investigated MATH-627, and I think we can remove the additional null
> checks (tested locally):
> 
>  * the iterators in RealVector and ArrayRealVector never return null as a
> result from next()
>  * next() is only called when hasNext() returns true
> 
> The thing I want to discuss is that RealVector is only an abstract class,
> meaning that it may be used as base class for user specific implementations
> (like in the test cases).
> Now any implementation has to provide an iterator that follows the same
> assumptions as in the base implementation, i.e. never return a null entry.
> 
> Imo, an implementation that returns a null entry although the iterator
> states it has more entries is buggy and thus should fail (atm, returning a
> null entry would terminate while loops iterating over such an iterator).
> So I think it should be safe to remove the null checks and add a note to
> the javadoc that any derived classes have to return an iterator following
> the same convention.
> 
> Any objections?

No problem from me, your rationale seems good.

Luc

> 
> Thomas
> 


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


Mime
View raw message