출처: 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.
'Archive' 카테고리의 다른 글
표준 Java 코드 스타일 (0) | 2011.09.21 |
---|---|
Static 메소드에서 Synchronized 사용하는 방법 (0) | 2011.09.21 |
Fail-Fast란? (0) | 2011.09.21 |
안드로이드에서의 Multithreading 예제 (0) | 2011.09.21 |
Java Heap에 대한 10가지 사항 (0) | 2011.09.20 |