Ids Copying to set without for loop

 How to copy Ids from SOQL query results to “SET” without for loop?

List<Account> accList = [SELECT Id, Name FROM Account];

Set<Id> accIds = new Map<Id, Account>(accList).keySet();

System.debug('Ids copied to Set '+accIds);
tHiNk gooD and dO thE bEsT.........MANJU NATH 🌝

Comments

Post a Comment