Steven Rodeo wrote:
But why are the entries in the HashTable a Linked List ?. I am a lil confused.
It's a linked list for two reasons... (1) There isn't a bucket per hashcode. Many hashcodes share the same bucket. ie... it is possible to have more than one hashcode per bucket. (2) Just because two objects have the same hashcode, doesn't mean that they are equal. The list is required for two objects that hash to the same bucket -- but are not equal.
Remember, according to the hashcode contract, "equal" instances must return the same hashcode. But it is not required that unequal objects return different hashcodes.
So in the context of a hashmap: Yes, multiple keys can certainly share the same hashcode. But in a map, each key must be unique (meaning not equal).
...will result in two separate entries if A and B are not equal, regardless of whether A and B have the same hashcode. On the other hand, if A and B are equal, then this will result in only one entry, because keys must be unique, so (B, Y) will replace (A, X).
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com