Is key unique in HashMap Java?

HashMap is a collection to store (key,value) pairs and According to the documentation of HashMap the keys are always unique . If you add a key which already exists(collision) in the hashmap, the old value will be replaced.

Sizin İçin Seçtik  Can you actually make money on Udemy?

Leave a Reply

Your email address will not be published. Required fields are marked *