Small things in Apex which we can achieve in a smart way! - Part 2
Hope you guys enjoyed reading Part1. Here we go! Below mentioned are few things which you might have missed while coding. Happy reading!!. Mixed Save Actions on sObject Lists: While working in Trigger or an ApexClass, we generally prepare different lists of multiple object types and perform DML operations for each sObject list. For example, to update accounts, contacts & cases we prepare List<Account>, List<contact> & List<case>, then we update each list separately which consumes unnecessary DML operations. Instead, we can simply put all the three lists into a single sObject list and perform the DML only once. Let's get into details on how this works. In the above code snippet contactList contains 3 records say c1, c2, c3, accountList has 2 records say a1, a2 and caseList has...