HashMap and Hashtable are two things used with Java. One of the most important things to know about HashMap and Hashtable when deciding which one to use is about their synchronization. There is no synchronization with a HashMap, and there is synchronization with a Hashtable. There is thread-safe with a Hashtable, and it is not threaded safe.
HashMap should be used when threading is not needed, and Hashtable should be used with threading. One null key is permitted with the HashMaps, and no invalid keys are allowed with Hashtables. If you need one that takes up less space but is fast, then you should use HashMap because Hashtable is slower and takes up more memory space. It is better to use unsynchronized like Hashtable because they perform better.