- We know that equals() and hashCode() contract that two unequal object in Java can have same hashcode.
- Since hashcode is same, bucket location would be same and collision will occur in HashMap.
- Since HashMap use LinkedList to store object, this entry (object of Map.Entry comprise key and value ) will be stored in LinkedList.
- There are many collision resolution methods available this is simplest and HashMap in Java does follow this.
No comments:
Post a Comment