What is Hash Collision in Java ?

In a Hashing scenario, at times two different objects may have same HashCode but they may not be equal. Therefore, Java will face issue while storing the two different objects with same HashCode in a HashMap. This kind of situation is Hash Collision.

There are different techniques of resolving or avoiding Hash Collision. But in HashMap, Java simply replaces the Object at old Key with new Object in case of Hash Collision.



You May Interest

What are the Differences Between a List and Set Collection in Jav ...

How Will You Include a Static File in a JSP Page ?

Why Java Does Not Support Operator Overloading ?

What is an EnumSet in Java ?

Enumeration and Iterator, Which One Has Better Performance in Jav ...