Difference between HashMap and ADT Dictionary

What is the difference between a hash map and an ADT dictionary. And when to prefer one by one. For my programming assignment, my instructor asked me to use one of them, but I do not see any difference between them. It is estimated that the program will work with a huge no. lines. Any suggestions?

+44
java data-structures
Nov 06 '08 at 0:40
source share
4 answers

In Java terms, both the HashMap class and the Dictionary class are implementations of the Map abstract data type. Abstract data types do not belong to any programming language, and ADT cards can also be known as a Hash or Dictionary or Associative array (others at http://en.wikipedia.org/wiki/Associative_array ). (Note that we make a distinction between the Dictionary class and the ADT dictionary.)

The Dictionary class has been deprecated, so it’s best not to use it.

+45
Nov 17 '08 at 22:06
source share

This post does a good job explaining the main differences:

Java hashmap vs hashtable

Note that a hashtable is just an implementation of the ADT dictionary. Also note that Java considers the dictionary "deprecated . "

The fact that the hashtable is in sync doesn't buy you for most purposes. Use a HashMap.

+12
Nov 06 '08 at 0:56
source share

In Java, HashMap implements the Map interface, while the dictionary does not. This makes the dictionary obsolete (as per API docs). That is, they both perform a similar function, so you are right that they seem very similar ... HashMap is a type of dictionary.

You are advised to use a HashMap, though.

+7
Nov 06 '08 at 0:54
source share

A map is an interface for ADT in Java, the same general language-independent data structure for supporting <key, value> pairs, and introduced in Java 1.2.

A dictionary (not a Map implementation) is an abstract class for the same purpose that was introduced earlier in JDK 1.0. Its only subclass is Hashtable, which itself implements Map. However, now the dictionary class is out of date, and you can forget it.

There are differences between Map and Dictionary function members, however you may find the difference between HashMap and Hashtable more useful. here you can find the differences.

0
Nov 07 '16 at 12:14
source share



All Articles