What happens internally when you put a key into a HashMap?
Strong answer
The key's hashCode is spread and masked to choose a bucket. If the bucket is empty the entry is stored; otherwise keys are compared with equals and the value is replaced or a new node is chained. Long chains are converted to balanced trees, and the table doubles when the size exceeds capacity times load factor.
