1,使用普通的旧的Hashtable
HashMap允许null作为key,而Hashtable不可以
2,使用Collections中同步化的包装方法synchronizedMap
3,使用concurrent包下的ConcurrentHashMap
//Hashtable Example Code
MapthreadSafeMap = new Hashtable ();
//synchronizedMap Example Code.
threadSafeMap = Collections.synchronizedMap(new HashMap());
//ConcurrentHashMap Example Code
threadSafeMap = new ConcurrentHashMap();
threadSafeMap .put("Key1", 123)
ConcurrentHashMap 性能最好