When ik create a list, set or map and add records to these do I need to update / insert after adding records. I did a test system debug on a testclass with only a return.
My debug returns a list with Ids, but I want to make shure I understand the concept
public static List<Account> createAccounts(Integer numAccts) {
List<Account> accList = new List<Account>();
at this point isnt accList empty? as accList = null?
for(Integer i=0;i<numAccts;i++) {
Account a = new Account(Name='TestAccount' +'-'+ i);
accList.add(a);
}
Do I not need to update or insert accList as a dml action at this point or is the a difference with a class or testclass?
return accList;
}