Duh.  Simplest approach wins!

On Sun, Dec 13, 2009 at 1:25 PM, Jake Mannix <[email protected]> wrote:

> > Following up on Jake's comment, could we have a marker interface that
> > indicates a function maps 0 to 0?  The abstract vector and matrix
> > implementations could use instanceOf to decide what to do.
> >
>
> I tried this when I was still trying to contribute to commons-math, but
> realized
> after several patch iterations that it's actually far easier to just do
> this:
>
>    Iterator<Element> e = (f.apply(0) == 0) ? iterateNonZero() :
> iterateAll();
>



-- 
Ted Dunning, CTO
DeepDyve

Reply via email to