Difference between a HashMap and a dictionary ADT

前端 未结 4 1271
一整个雨季
一整个雨季 2020-12-04 11:34

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 b

4条回答
  •  自闭症患者
    2020-12-04 11:51

    This Stack Overflow post does a good job explaining the key differences:

    Java hashmap vs hashtable

    Note that Hashtable is simply an implementation of the Dictionary ADT. Also note that Java considers Dictionary "obsolete".

    The fact that Hashtable is synchronized doesn't buy you much for most uses. Use HashMap.

提交回复
热议问题