0

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?

zhaokai
  • 1
  • 1

0 Answers0