嘻皮客娱乐学习网

标题: Vector, ArrayList, HashTable, HashMap哪些是线程安全的,哪些不是 [打印本页]

作者: 王天一    时间: 2014-11-30 12:34
标题: Vector, ArrayList, HashTable, HashMap哪些是线程安全的,哪些不是
Vector and Hashtable are two collection classes that are inherently thread safe or synchronized; whereas, the classes ArrayList and HashMap are unsynchronized and must be `wrapped` via Collections.SynchronizedList or Collections.synchronizedMap if synchronization is desired.
Vector和Hashtable是线程安全的,ArrayList和HashMap不是线程安全的而且必须要通过Collections.SynchronizedList或者Collections.synchronizedMap来包装一下才能实现同步。




欢迎光临 嘻皮客娱乐学习网 (http://www.xipick.com/) Powered by Discuz! X3.3