The new Objects class

Neal Gafter neal at gafter.com
Sun Jan 10 19:55:00 UTC 2010


On Sun, Jan 10, 2010 at 12:14 AM, Paulo Levi <i30817 at gmail.com> wrote:
> 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).
>
> When it could be rewritten as :
>
> public static int hash(Object value1, Object value2, Object... restOfValues)
>
> to avoid that.

That would make it hard to pass an array.



More information about the core-libs-dev mailing list