1、HashTable的方法是同步的;HashMap沒有同步,所以在多線程的場合要手動同步;
2、HashTable不能插入null的值(key、value都不可以);HashMap可以插入一個null的key、多個null的value;
3、HashTable使用的是Enumeration,而HashMap使用的是Iterator;
5、HashTable的hash數組默認為11,增加方式為2 * oldSize + 1;HashMap的hash數組默認為16,而且一定是2的指數;
--------------------------------------------------------------------------------------------
1、HashTable與HashMap都實現了Map<K,V>, Cloneable, Serializable接口;
2、內部邏輯實現都有各自的Entry<K, V>的內部類;
posted on 2011-03-08 21:32
showsun 閱讀(315)
評論(0) 編輯 收藏 所屬分類:
J2SE