Maps: Id to Account
A Map<Id, Account> stores each Account under its Id.
Your task
Build an Id-to-Account Map from a List, look up a known key and a missing key, and loop over every key.
Id cedarId = Id.valueOf('001000000000001');
Id northstarId = Id.valueOf('001000000000002');
Id missingId = Id.valueOf('001000000000099');
List<Account> accountList = new List<Account>{
new Account(Id = cedarId, Name = 'Cedar Labs'),
new Account(Id = northstarId, Name = 'Northstar Co')
};
Map<Id, Account> accountsById = null;Requirements
Fetched account: Northstar Coshould be printedHas missing key: falseshould be printedMissing value: nullshould be printedLoop name: Cedar Labsshould be printedLoop name: Northstar Coshould be printednew Map<Id, Account>(accountList)should be used- for-each loop should be used over
accountsById.keySet()