How does a `HashMap` resolve hash collisions in Java?
A `HashMap` resolves hash collisions by using a method called rehashing, where the entire map is resized.
Actually, rehashing occurs when the load factor exceeds a certain threshold, but it's not the primary method for resolving hash collisions. Collision resolution usually happens through chaining or balancing the tree.
Can you explain the role of the load factor in `HashMap` resizing?