Originally posted by dolly shah:
Why you need to override equals() for key? page:525...
I don't have the book, so I don't know the context.
But because it's called "key," my
guess is that it is being used in a Map (which stores key/value pairs). In a Map, keys must be
unique because they are used to lookup the associated value. Therefore, this class would need a meaningful implementation of equals to ensure that the Map is not accepting "duplicate" keys.