as we all known,CopyOnWriteArrayList can resolve the problem when the List visited by multiThread , in Java ,when we want to change the value in the list ,it makes a copy in memory. but in android ,when we call this method such as get() , it may throw ConcurrentModificationException,it is because when we call the subList() of the CopyOnWriteArrayList in android ,it make an object called CowSubList, and it has a method called Slice.checkConcurrentModification() and it throws an ConcurrentModificationException.how can I solve the problem ,when a thread is adding an item to the list and another one is visiting the list?
Asked
Active
Viewed 18 times
0
-
`ConcurrentModificationException` is **not** related to multithreading. – Kayaman May 16 '16 at 14:50
-
what's the meaning ? I want to visit the data in the list and add data to the list at the same time . – zhaokai May 16 '16 at 14:59