Difference between CopyOnWriteArrayList and synchronizedList

前端 未结 3 1942
春和景丽
春和景丽 2020-12-29 05:19

As per my understanding concurrent collection classes preferred over synchronized collections because the concurrent collection classes don\'t take a lock on the complete co

3条回答
  •  一生所求
    2020-12-29 06:17

    1) get and other read operation on CopyOnWriteArrayList are not synchronized.

    2) CopyOnWriteArrayList's iterator never throws ConcurrentModificationException while Collections.synchronizedList's iterator may throw it.

提交回复
热议问题