while trying to clone an array of objects, i am getting an error when the array is not completely full. if the list is full, everything works just fine!
this is my code:
public Object clone() throws CloneNotSupportedException {
EmployeeList listBackup = new EmployeeList();
for (Employee employeeObj : listEmployee){
listBackup.add( (Employee) employeeObj.clone() );
}
return listBackup;
}
is there any other way to rewrite this code, when the element in the array is null?