Archive
HashMap 과 Hashtable의 차이
epicdev
2011. 9. 21. 03:06
출처: http://stackoverflow.com/questions/40471/java-hashmap-vs-hashtable
There are several differences between HashMap and Hashtable in Java:
There are several differences between HashMap and Hashtable in Java:
- Hashtable is synchronized, whereas HashMap is not. This makes HashMap better for non-threaded applications, as unsynchronized Objects typically perform better than synchronized ones.
- Hashtable does not allow null keys or values. HashMap allows one null key and any number of null values.
- One of HashMap's subclasses is LinkedHashMap, so in the event that you'd want predictable iteration order (which is insertion order by default), you could easily swap out the HashMap for a LinkedHashMap. This wouldn't be as easy if you were using Hashtable.