+ 2

where are the best places to use hash maps

what are the applications of hash maps

17th Mar 2019, 3:31 AM
Umar Idris
Umar Idris - avatar
2 Réponses
+ 3
Hashmaps are good when you're trying to keep a "dictionary" of items. Let's say, for example, you have a phonebook. That phonebook has a list of names and a list of phone numbers, and order isn't necessary. You can use a hashmap to store the names as keys and allocate each name to a phone number. This isn't as easy with other types of collections, like lists that store a value with an index in an order. Sure, you can decide to use things like parallel arrays or parallel lists, but why bother? Hashmaps are easier to read and are already built in for you to use for a key:value pair. If you do need to retain order, you can also use subclasses like linkedHashMap (at least, in Java you can - not sure about other languages). Hope this helps.
17th Mar 2019, 5:29 AM
Sheldon Duncan
Sheldon Duncan - avatar
0
I use pycharm.
17th Mar 2019, 10:30 AM
Mostafa
Mostafa - avatar