HashMap允许键和值是null,而Hashtable则不允许键或者值是null。 Hashtable是同步的,而HashMap不是,所以HashMap更适用于单线程环境,Hashtable则适用于多线程环境。