How will rehashing be done if we keep getting the items with the same hashcode? Or may be the question is - What will be 'rehashed' if we keep getting items with the same hashcode?
This is actually an implementation detail -- and not really that relevent to know, but since you are interested...
The number of buckets is determined when the hashmap is first instantiated. When a element is added, it is normalized to find the right bucket to place it in. For example, if there is 10 buckets, the range of possible hashcodes (an int value) is divided by 10 groups to determine which bucket to place. There is no bucket that matches the hashcode. Two hashcodes may end up in the same bucket by this normalization.
Anyway, the hashmap also keeps track of the number of elements, and when it exceeds a certain value. It will change the number of buckets. This is needed in order to keep access at constant time -- lower the need to search though buckets. When this happens, the hashmap needs to rehash every element, in order to determine which buckets it should go to. It can't move all the elements in the bucket (together, to a new bucket), because two elements that used to be in the same bucket, prior to the rehash, may not be in the same bucket, after.
Henry