What is hashmap in java ? | SoloLearn: Learn to code for FREE!


What is hashmap in java ?

Can anyone explain this to me clearly

2/15/2019 8:42:40 AM

Chandra Prakash Singh Bisht

3 Answers

New Answer


HashMap is a data structure that uses a hash function to map identifying values, known as keys, to their associated values. It contains “key-value” pairs and allows retrieving the value by key. They are good to use when you have a large amount of data and you need to check for specific data. https://docs.oracle.com/javase/tutorial/collections/interfaces/map.html


It is like list of values with access keys to them and key name you can choose: brother - John; mother - Marta; uncle - Ban; ... OR 1 - John; 2 - Marta; 3 - Ban; ... With array you call value with index, with hashmap with key.


HashMap is used to storing data in form of index(key) and value