Computer Science, asked by paraghq6538, 1 year ago

Is it possible to solve concurrent modification exception in oridinary for loop

Answers

Answered by Raju2392
0

Answer:

To Avoid ConcurrentModificationException in multi-threaded environment

You can convert the list to an array and then iterate on the array. ...

You can lock the list while iterating by putting it in a synchronized block. ...

If you are using JDK1.5 or higher then you can use ConcurrentHashMap and CopyOnWriteArrayList classes.

Similar questions