Hi,

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?

Thomas

Reply via email to