rendered paste bodypackage trabalhoPDS.catalogo;
import java.util.Iterator;
import java.util.List;
public class DeepClone implements CloneStrategy {
public List<Produto> handleChildren(List<Produto> list) {
List<Produto> newList = null;
try {
newList = list.getClass().newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Iterator<Produto> it = list.iterator();
while(it.hasNext()){
try {
newList.add(it.next().cloneProduto());
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return newList;
}
}