I don't agree with the answer.
It's true to say we can't be sure about equality of two object with the hascode method.
but, for inequality it's the same as 2 non equal objects should have the same hascode. So testing the inequality with a hascode can't give a sure answer about inequality.
About Question enthuware.ocpjp.v7.2.1515 :
Moderators: Site Manager, fjwalraven
-
- Posts: 33
- Joined: Thu Jul 18, 2013 6:06 pm
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1515 :
This is what it means - if the two hashcodes are equal, we can't say whether the objects are equal or not. But if two hashcodes are not equal, we can be sure that the objects are not equal.
HTH,
Paul.
HTH,
Paul.
-
- Posts: 32
- Joined: Wed Aug 28, 2013 6:12 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1515 :
Two typos:
"...the equals and hashCode contracted not violated..."
and
"...if the hash codes for two objects is same, you..."
Cheers
"...the equals and hashCode contracted not violated..."
and
"...if the hash codes for two objects is same, you..."
Cheers
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1515 :
Fixed.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
Who is online
Users browsing this forum: No registered users and 1 guest