What is the requirement for an object to be used as key or value in HashMap?



The put() method of HashMap works in the principle of hashing. It is responsible for storing an object into backend array. The hashcode() method is used in conjunction with a hash function to find the correct location for the object into the bucket. If a collision occurs then the entry object which contains both key and value is added to a linked list and that linked list is stored into the bucket location

codebingo@4905 2 years 0 Answers 2793 views

Leave an answer