|
|
|
||
|
int hashValue = 0;
for(final Iterator i=entrySet().iterator(); i.hasNext(); )
hashValue += i.next().hashCode();
(This is noted in the javadoc for If you have a significant number of entries in your I would recommend subclassing and overriding
int hashValue = 0;
for(final Iterator i=keySet().iterator(); i.hasNext(); )
hashValue += i.next().hashCode();
as it is common to use simple types for the keys of a map. The use of If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result. contract of If you're jamming a Don't forget that you're still going to get hit with the |
| Post a comment |
|
|
Unless otherwise expressly stated, all original material of whatever nature created by Rob Grzywinski and included in this weblog and any related pages, including the weblog's archives, is licensed under a Creative Commons License. |