Le 09/09/2009 22:40, Joe Darcy a écrit :
Hello.
For JDK 7, I think it is high-time the platform included a class like
java.util.Objects to hold commonly-written utility methods. For
example, a two-argument static equals method that returned true if
both arguments are null, returns false is one argument is null, and
otherwise returns the result of calling arg1.equals(arg2) (6797535
"Add shared two argument static equals method to the platform").
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.
What other utility methods would have broad enough use and
applicability to go into a common java.util class?
-Joe
Some hashCode builder like:
http://commons.apache.org/lang/api/org/apache/commons/lang/builder/HashCodeBuilder.html
(without the methods that use reflection).
It will force all VMs to have a better escape analysis :)
Rémi