InterviewSolution
| 1. |
What Are The Different Types Of Collections In Apex? What Are Maps In Apex? |
|
Answer» Collections are the type of variables which can be used to store multiple NUMBER of records (data). It is useful because Governor Limits restrict the number of records you can retrieve per transaction. Hence, collections can be used to store multiple records in a single VARIABLE DEFINED as type collection and by retrieving data in the form of collections, Governor Limits will be in check. Collections are similar to how arrays work. There are 3 collection types in Salesforce:
Maps are used to store data in the form of key-value pairs, where each unique key maps to a single value. SYNTAX: Map<String, String> country city = new Map<String, String>(); Collections are the type of variables which can be used to store multiple number of records (data). It is useful because Governor Limits restrict the number of records you can retrieve per transaction. Hence, collections can be used to store multiple records in a single variable defined as type collection and by retrieving data in the form of collections, Governor Limits will be in check. Collections are similar to how arrays work. There are 3 collection types in Salesforce: Maps are used to store data in the form of key-value pairs, where each unique key maps to a single value. Syntax: Map<String, String> country city = new Map<String, String>(); |
|