The new Objects class (original) (raw)

Paulo Levi i30817 at gmail.com
Sun Jan 10 08:14:48 UTC 2010


Just seen the new Objects class in the java.util.

I'd like to ask why does the

public static int hash(Object... values)

method, has the warning: * Warning: When a single object reference is supplied, the returned value does not equal the hash code of that object reference.* This value can be computed by calling hashCode(Object)<http://download.java.net/jdk7/docs/api/java/util/Objects.html#hashCode%28java.lang.Object%29> .

When it could be rewritten as :

public static int hash(Object value1, Object value2, Object... restOfValues)

to avoid that. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100110/74146b47/attachment.html>



More information about the core-libs-dev mailing list