Hi All,
I was asked this question in an interview.How can we make an ArrayList synchronized.
I said by doing like this -
public List getList() {
synchronized(myList) {
return new ArrayList(myList);
}
}
Kindly tell me whether i was wrong or right.What are the ways we can make an arraylist synchronized.