I have this question.
I am working in my project (I also use emf) I need to keep a unique ID for each object that I am using, so I used to identify HashCode Decided, as far as I understand, this value is similar to compilation.
I have given the object as a parameter in the law of another class, but when I try to get the hashod, this is not what I print the value of the object.
Something like this:
But as a result I get this: is an object : hash id is: As you can see that two values are completely different, but I do not understand that the only thing that I have (and this works) is the st To get the ring and then I appreciate any answer. Regards I need to keep a unique ID to use every object, so I use the identity of HashCode I have decided, as far as I think this value is similar to compilation. No, it has nothing to do with compilation, and it no Not is guaranteed to be unique. It is not clear what you are trying to do, but you are unique in the form of hash codes - they are not guaranteed to happen. equally practical enough, Although it is not the same thing as a guarantee. due to being confused with the result of calling Returns the string of the toString method for the class object, the object of the range whose object is an example, the sign-on character '@', and the trailing de hexadecimal object Represent the hash code of T. In other words, this method returns a string equal to one: System.out.println ("Object is:" + obj)
System. Out.println (hash id is: + Integer.toHexString (System.identityHashCode (obj));
*** Xxxxxxxxxxxxxx***.EntityImpl@18e588c (name: comment) has been deleted.
1ec1758 < / P>
18e588c (for this example)
Object.hashCode specifies the document:
toString () - I suspect that your class actually overrides
hash code ( ) , and
Object.toString () instead of using the hash code, instead of potentially override
hashhead () method calls: < Blockquote>
getClass (). GetName () + '@' + Integer. HostStress (hash code ())
ToString .
No comments:
Post a Comment