Possible Duplicate:
Differences between HashMap and Hashtable?
I've seen hash tables and hash maps used in different code but they look like they do the same thing. Is there a difference between them? Which one should I use in my code?
java.util.Hashtable methods are synchronized , java.util.Hashmap methods are not. If you use Hashtable there will be a performance hit as no two threads will be able to access its methods at the same time. If you care about Thread safety in your app Hashtable is the way to go. if you dont care about thread safety Hashmap is the way to go as it is mor eefficient then hashtable. also java.util.Hashtable doesnt allow any null keys, where as java.util.HashMap allows one null key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With