The Artima Developer Community
Sponsored Link

By George, You're Right!

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

By George, You're Right!

Posted by Bill Venners on 16 Sep 1998, 1:19 AM

> Quoting the docs:

> "If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result."

> Otherwise, the object will not work properly as an element of a hashed collection (Set) or as a key in a hashtable.

> See:
> http://java.sun.com/products/jdk/1.1/docs/api/java.lang.Object.html#hashCode()
> http://java.sun.com/products/jdk/1.1/docs/api/java.lang.Object.html#equals(java.lang.Object)

> - -- J

Thanks Jody, you found a bug in my idiom. I'll fix it.

bv



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us