Why String is used as key value in HashMap?

While defining HashMap why String is used as key value over other object values?

Showing Answers 1 - 1 of 1 Answers


  • Oct 8th, 2015

It is immutable and hashcode of immutable objects has less possibility of hash collisions.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions