What methods should go into a java.util.Objects class in JDK 7?

Ismael Juma mlists at juma.me.uk
Wed Sep 9 22:26:46 UTC 2009


Joe Darcy <Joe.Darcy at ...> writes:
> A static hashCode method returning 0 for null and the value of 
> arg.hashCode() has also been suggested.
> 
> A set of
> 
>     static int compareTo(int, int)
>     static int compareTo(long, long)
>     ....
> 
> methods probably belongs somewhere in the platform too.

Although I think a java.util.Objects is probably a good idea, the compareTo
methods for primitives should probably go to their own primitive class and be
called compare to match the one in Double:

    public static int compare(double d1, double d2)

Best,
Ismael




More information about the core-libs-dev mailing list