I have a pre-populated array list. And I have multiple threads which will remove elements from the array list. Each thread calls the remove method below and removes one item from the list. Does the following code give me consistent behavior ?
ArrayList<String> list = Collections.synchronizedList(new ArrayList<String>());
void remove(String item)
{
do something; (doesn't work on the list)
list.remove(item);
}
Thanks!
See Question&Answers more detail:os