I am wondering how I could produce a clone of my array in the following scenario:
private List<TestObject> testList = Collections.synchronizedList(new ArrayList<TestObject>());
....
public synchronized List<TestObject> getAllTestObjects(){
return testList.clone();
//I have tried casting to List<TestObject>
}
It is moaning about clone() being undefined for List. But I am not sure how best to get around it?
Any help would be greatly appreciated.