If we want to represent a group of individual objects as a single entity, then we should go with collections.

There are 3 types of collections ;

  • 1. List: A list is an unordered collection of data of primitive datatypes or sObjects.
  • 2. Set:  A set is an unordered collection of data of primitive datatypes or sObjects with unique values.
         Set are commonly used to store values that are used to filter data that is queried by                 SOQL query.

  • 3. Map: A map is a collection of data in the form of key-value pairs where key must be unique but values can be duplicated.
              Maps are commonly used as a cache of records that can be 
              accessed by key/Id.