Doug Lea dl at
Sun Sep 16 06:14:18 PDT 2012

One further note on defining the Numeric interface.

Suppose you have a reduction-style operation with a
basis (initial or default value) argument:

   <N> Numeric<N> reduce(SomeType basis, BiFun<...> combiner);

"SomeType" cannot be any Number class because Number is
not itself Numeric. The best way out is to retrofit
Number to implement Numeric. The interface-ness
is basically why Numeric is needed to begin with.

Doing this would not be strictly necessary, but
all the other alternatives (like creating new classes
that DO claim to implement Numeric) are worse.
It would probably be better to do nothing at all.


More information about the lambda-libs-spec-observers mailing list