[問題]:它是線程安全的使用ConcurrentHashMap<Object, ConcurrentHashMap<Object, Object>>
與否。一個內部另一個併發收集:是線程安全
[可選回答]:還有什麼關於另一個並行的地圖類型?那麼併發集合呢?
附:我只問java.util.concurrent
包。
具體用法語境:
//we have
ConcurrentHashMap<Object, ConcurrentHashMap<Object, Object>> map = new ConcurrentHashMap<Object, ConcurrentHashMap<Object, Object>>();
//each string can be executed separately and concurently
ConcurrentHashMap<Object, Object> subMap = new ConcurrentHashMap<Object, Object>()
map.put(key, subMap);
map.remove(key);
map.get(key);
map.get(key).put(key, ref);
map.get(key).remove(key);
也許我的解決方案奠定了周圍番石榴HashBasedTable?
這是爲什麼? ConcurrentHashMap畢竟是線程安全的。 – Antoniossss
@Keppil我希望有人描述的情況不是 –
這段代碼似乎沒有編譯。沒有map.put(object)方法。 –