Difference between a HashMap and a dictionary ADT

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

    Map is an interface for an ADT in Java, the same general language-independent data structure for maintaining pairs, and is introduced in Java 1.2.

    Dictionary (not an implementation of Map) is an Abstract class for the same purpose introduced earlier in JDK 1.0. The only subclass it has is Hashtable which itself is implementing Map. Nevertheless, Dictionary class is obsolete now and you may forget it.

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

提交回复
热议问题