线程安全的集合
//make thread-safe list List MyStrList = Collections.synchronizedList(new ArrayList()); MyStrList.add("123"); MyStrList.add("abc"); //make thread-safe hashset Set set=Collections.synchronizedSet(new HashSet()); set.add(123); set.add(456); //make thread-safe hashmap Map map=Collections.synchronizedMap(new HashMap()); map.put(1, "thb"); map.put(12, "bill tang");
CopyOnWriteArrayList与Collections.synchronizedList的性能对比
http://blog.csdn.net/zljjava/article/details/48139465