HashTable和HashMap的不同主要有四種 一、 HashTable 是繼承java.util.Dictionary HashMap 是繼承java.util.AbstractMap Dictionary 是舊的class, 【DOC】NOTE: This class is obsolete. New implementations should implement the Map interface, rather than extending this class. java.util.AbstractMap 已經implements Map Interface,因此繼承它的class 只需要實作它的method就可以實作出需要的Map (例如get,put,entrySet method) 可參:http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractMap.html java.util.Dictionary 並沒有去Implements Map Interface,HashTable是另外去實作Map interface,也因此HashTable能被算在Java Util Framework中。 ...
留言