W
Wojtek
If I have a HashMap<String,MyObject>, then the HashMap uses the hash of
the String to place MyObject in its internal storage. If the hash for a
String is the same as another String, then what?
I assume that the hash collision mechanism uses toString() to resolve
which String you are specifying.
OK so far.
Now if I have a HashMap<MyKey,MyObject), then the HashMap uses the hash
of MyKey. What if this also produces a collision? If the toString() is
used, and I have not provided a MyKey specific toString(), then the
default toString() is the class name plus the hash.
In that case I over-write the previous MyKey entry.
Or am I missing something....
the String to place MyObject in its internal storage. If the hash for a
String is the same as another String, then what?
I assume that the hash collision mechanism uses toString() to resolve
which String you are specifying.
OK so far.
Now if I have a HashMap<MyKey,MyObject), then the HashMap uses the hash
of MyKey. What if this also produces a collision? If the toString() is
used, and I have not provided a MyKey specific toString(), then the
default toString() is the class name plus the hash.
In that case I over-write the previous MyKey entry.
Or am I missing something....