用Collections.synchronizedCollection创建线程安全的集合、列表。。。

 Collection c=Collections.synchronizedCollection(new ArrayList());
 List list=Collections.synchronizedList(new ArrayList());
 Set s=Collections.synchronizedSet(new HashSet());
 Map m=Collections.synchronizedMap(new HashMap());

posted @ 2016-11-18 16:53  tianSky  阅读(708)  评论(0编辑  收藏  举报