java.util.Objects, round two

Paul Benedict pbenedict at apache.org
Wed Oct 14 08:05:01 UTC 2009


Joe,

I am confused over this warning:
> * <b>Warning: When a single object reference is supplied, the returned
> * value does not equal the hash code of that object reference.</b> This
> * value can be computed by calling {@link #hashCode(Object)}.

I first looked into Arrays#deepHashCode and did not see any companion
warning there; therefore I am presuming this is new functionality. Two
questions remain based on looking at the javadoc alone and not knowing
its implementation:

For when a single object reference is supplied:
1) Why is the hash code not the hash code of the single object? Is
there harm in doing so?
2) Then what gets hashed? Dunno...

I think the second question is begged but not explicitly answered by
the documentation.

Paul



More information about the core-libs-dev mailing list