If I have something like this snippet-
public List<E> list = Collections.synchronizedList(new ArrayList<E>());
then if I do some operations inside a method -
boolean absent = !list.contains(x); // Statement 1
if(absent) // Statement 2
list.add(x); // Statement 3
do I need to wrap the above statements inside synchronized(list){ ... }
to make the operations atomic
?