该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
好像Collections里面有方法可以让一般的**类变成线程安全的:
static Collection
synchronizedCollection(Collection c)
Returns a synchronized (thread-safe) collection backed by the specified collection.
static List
synchronizedList(List list)
Returns a synchronized (thread-safe) list backed by the specified list.
static Map
synchronizedMap(Map m)
Returns a synchronized (thread-safe) map backed by the specified map.
static Set
synchronizedSet(Set s)
Returns a synchronized (thread-safe) set backed by the specified set.
static SortedMap
synchronizedSortedMap(SortedMap m)
Returns a synchronized (thread-safe) sorted map backed by the specified sorted map.
static SortedSet
synchronizedSortedSet(SortedSet s)
Returns a synchronized (thread-safe) sorted set backed by the specified sorted set.