Last active
March 17, 2017 07:04
-
-
Save xgeek-net/b1ca85867f3b97846fa0e538fa88ae01 to your computer and use it in GitHub Desktop.
sObject List to Map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<Account> accountList = [SELECT Id, Name FROM Account LIMIT 10]; | |
Map<Id, Account> accountMap = new Map<Id, Account>(); | |
if(accountList != null && !accountList.isEmpty()){ | |
for(Account acc : accountList){ | |
accountMap.put(acc.Id, acc); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment