Key learnings:
- Objects used as keys should override hashCode() and equals() for best performance.
- In the implementation of hashCode(), it is not necessary for distinct objects to generate distinct hashCodes.
- Distinct objects with coincidentally identical hashCodes() will be placed in the same "bucket" in which sequential search using "equals" will be done.
No comments:
Post a Comment