You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by Raghu Angadi <ra...@yahoo-inc.com> on 2007/08/31 01:01:13 UTC

hash Code of a reference.

I want to get hashCode of a reference, i.e. Object.hashCode() or 
something similar. ref.hashCode() won't work since this perticular class 
overrides hashCode(). Is there a simple way to get Object.hashCode() or 
some other hash of a ref?

Right now I am thinking of adding a method
'int refHashCode() { return super.hashCode(); }' since this class 
subclasses Object.

Raghu.

Re: hash Code of a reference.

Posted by Raghu Angadi <ra...@yahoo-inc.com>.
Martin Traverso wrote:
> Try System.identityHashCode(...).
> 
> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#identityHashCode(java.lang.Object)

Perfect. Exactly what I wanted. Thanks.

Raghu.

> Martin
> 
> On 8/30/07, Raghu Angadi <ra...@yahoo-inc.com> wrote:
>>
>> I want to get hashCode of a reference, i.e. Object.hashCode() or
>> something similar. ref.hashCode() won't work since this perticular class
>> overrides hashCode(). Is there a simple way to get Object.hashCode() or
>> some other hash of a ref?
>>
>> Right now I am thinking of adding a method
>> 'int refHashCode() { return super.hashCode(); }' since this class
>> subclasses Object.
>>
>> Raghu.
>>
> 


Re: hash Code of a reference.

Posted by Martin Traverso <mt...@gmail.com>.
Try System.identityHashCode(...).

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#identityHashCode(java.lang.Object)

Martin

On 8/30/07, Raghu Angadi <ra...@yahoo-inc.com> wrote:
>
>
> I want to get hashCode of a reference, i.e. Object.hashCode() or
> something similar. ref.hashCode() won't work since this perticular class
> overrides hashCode(). Is there a simple way to get Object.hashCode() or
> some other hash of a ref?
>
> Right now I am thinking of adding a method
> 'int refHashCode() { return super.hashCode(); }' since this class
> subclasses Object.
>
> Raghu.
>