Difference between a HashMap and a dictionary ADT

前端 未结 4 1296
一整个雨季
一整个雨季 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:54

    In terms of Java, both the class HashMap and the class Dictionary 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 the Dictionary class and the Dictionary ADT.)

    The Dictionary class has been marked as obsolete, so it's best not to use it.

提交回复
热议问题