+ 1
What is the use of synchronization in java e.g. java arraylist is non synchronized... what does it really means
need suggestions
2 ответов
+ 6
@Felipe Is it like I have an Array List, if I run Thread A and Thread B, in which Thread A remove one of the element in the Array List, then the index of the other elements after it will change, then when I access the Array List in Thread B will cause problem?
+ 1
It is a multithread concept.
Synchronized methods enable a simple strategy for preventing thread interference and memory consistency errors.
Accessing an ArrayList instance from multiple threads may not be thread safe if you don't manage that.