Hi all,
do i need to synchronize this, when many threads accessing the get Method and only one thread is accessing the setList method?
public class ListContainer {
private List<String> myList = new ArrayList<String();
public List<String> get ( )
{
return new ArrayList<String>(myList);
}
public List<String> set ( )
{
this.myList = computeList();
}
}
I dont care if readers get old data, but the data should be consistent.
Janning