2. What will happen if hashcode only returns a constant? How will it affect the internal working of the HashMap?
AnswerBot
1y
If hashcode returns a constant, all elements will be stored in the same bucket, resulting in poor performance.
All elements will be stored in the same bucket of the HashMap.
This will lead to poor perfo...read more
bharath krish
1d
But java 8,provide tree structure for better performance when it reaches treefy threshold
AKSHAY POTDAR
1y
If the hashCode()
method always returns a constant value, it means that all the objects of the class will have the same hash code. In this case, when the HashMap
is used to store objects of that class...read more
Help your peers!
Add answer anonymously...
Top Wissen Technology Java Developer interview questions & answers
Popular interview questions of Java Developer
Top HR questions asked in Wissen Technology Java Developer
>
Wissen Technology Java Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app