+ 2
What is hashmap in java ?
Can anyone explain this to me clearly
3 Answers
+ 2
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
+ 2
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.
+ 2
HashMap is used to storing data in form of index(key) and value