What is the difference between a Hash Map and dictionary ADT. And when to prefer one over another. For my programming assignment my instructor has asked to use one of them but I don't see any difference in between both. The program is supposed to work with a huge no. of strings. Any suggestions?
Java – Difference between a HashMap and a dictionary ADT
data structuresjava
Related Topic
- Java – the difference between public, protected, package-private and private in Java
- Python – the difference between Python’s list methods append and extend
- Java – Difference between StringBuilder and StringBuffer
- Java – Difference between wait() and sleep()
- Java – Difference between HashMap, LinkedHashMap and TreeMap
- Java – What’s the difference between @Component, @Repository & @Service annotations in Spring
- Python – How to remove a key from a Python dictionary
Best Answer
In terms of Java, both the class
HashMap
and the classDictionary
are implementations of the "Map" abstract data type. Abstract data types are not specific to any one programming language, and the Map ADT can also be known as a Hash, or a Dictionary, or an Associative Array (others at http://en.wikipedia.org/wiki/Associative_array). (Notice we're making a distinction between theDictionary
class and the Dictionary ADT.)The
Dictionary
class has been marked as obsolete, so it's best not to use it.