j.l.r.Parameter.hashCode() question
elena votchennikova
elena.votchennikova at oracle.com
Fri Oct 4 03:49:12 PDT 2013
Hi Joe,
thank you for the replay,
On 04.10.2013 5:03, Joseph Darcy wrote:
> Hello Elena,
>
> The general requirements from Object.hashCode hold: equal objects must
> have equal hash codes. (Of necessity, unequal objects may have the
> same hash code.)
Yep.
>
> The phrased "based on" means "some unspecified function of." It is
> generally undesirable to exactly specify a hash code function when you
> don't absolutely have to.
So, do you mean that the executable and the index are just used in this
"unspecified function" or do you want to say that if the executable and
the index are same, then the hash codes will be the same?
I just want to clarify it, because if the answer is "yes" then I think
this is not obviously from the wording "based on". And if the answer is
"no", that this is Ok.
But in the spec to the equals() method we have the same wording:
"Compares based on the executable and the index.". But what does this
exactly mean?
Thank you for your help,
Elena
>
> HTH,
>
> -Joe
>
> On 10/1/2013 6:54 AM, elena votchennikova wrote:
>> Hello,
>>
>> the API spec to the j.l.r.Parameter.hashCode() method says "Returns a
>> hash code based on the executable's hash code and the index."
>> Could you please explain me does this mean that the hash codes must
>> be identical for the two Parameters with the same executables and the
>> same indexes and the hash codes must be different for the Parameters
>> with different executables or indexes?
>> What does mean "based" in this context?
>>
>>
>> Thanks a lot,
>> Elena
>
More information about the enhanced-metadata-spec-discuss
mailing list