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
Map<String, String> sampleMap = new Map<String, String>{ | |
'key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3' | |
}; |
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
Map<String, String> sampleMap = new Map<String, String>(); | |
sampleMap.put('key1', 'value1'); | |
sampleMap.put('key2', 'value2'); | |
sampleMap.put('key3', 'value3'); |
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
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Id, Name FROM Account LIMIT 10]); | |
List<Id> idList = new List<Id>(accountMap.keySet()); |
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
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Id, Name FROM Account LIMIT 10]); | |
List<Id> idList = new List<Id>(); | |
for(Account acc : accountMap.keySet()){ | |
idList.add(acc.Id); | |
} |
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
Map<Id, Account> accountMap = new Map<Id, Account>([SELECT Id, Name FROM Account LIMIT 10]); |
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); | |
} | |
} |
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
System.debug(Logginglevel.INFO,'[INFO] Account : ' + account); | |
System.debug(Logginglevel.WARN,'[WARN] Account : ' + account); | |
System.debug(Logginglevel.ERROR,'[ERROR] Account : ' + account); | |
System.debug(Logginglevel.DEBUG ,'[DEBUG] Account : ' + account); |
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
/******* 1ST TRANSACTION *********/ | |
USER_DEBUG|[19]|DEBUG|>>> execute start at 2017/01/08 04:48:43 | |
USER_DEBUG|[28]|DEBUG|>>> publicValue : 1 | |
USER_DEBUG|[29]|DEBUG|>>> privateValue : 1 | |
USER_DEBUG|[30]|DEBUG|>>> execute end at 2017/01/08 04:48:48 | |
/******* 2ND TRANSACTION *********/ | |
USER_DEBUG|[19]|DEBUG|>>> execute start at 2017/01/08 04:48:48 | |
USER_DEBUG|[28]|DEBUG|>>> publicValue : 2 | |
USER_DEBUG|[29]|DEBUG|>>> privateValue : 2 |
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
global class SampleBatchWithState implements Database.Batchable<sObject>, Database.Stateful { | |
public Integer publicValue; | |
private Integer privateValue; | |
global SampleBatchWithState() { | |
publicValue = 0; | |
privateValue = 0; | |
} |
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
global class SampleBatch implements Database.Batchable<sObject> { | |
// The batch job starts | |
global Database.Querylocator start(Database.BatchableContext bc){ | |
String query = 'SELECT Id, Name FROM BatchData__c LIMIT 1000'; | |
return Database.getQuerylocator(query); | |
} | |
// The batch job executes and operates on one batch of records | |
global void execute(Database.BatchableContext bc, List<sObject> scope){ |