Why isn't the `Number` interface extending `Compa...
# language-proposals
h
Why isn't the
Number
interface extending
Comparable
? Being a number always superimposes an ordering imho.
l
Because of NaN?
h
I see the argument, but in fact
Double
is implemented as
Double private constructor() : Number(), Comparable<Double>
in the standard library, which somehow argues against it. AFAIK all other subtypes of
Number
(excluding Double and Flot) don't have a NaN value
l
You're right. I guess it's because Java's
Number
doesn't either? Regardless, it's pretty easy to make your own comparator that does a conversion beforehand.
f
The number interface is generally useless.
b
Also keep in mind that not all sets of numbers are ordered, such as complex numbers