A Step-by-Step Guide to Collections in Apex (Lists, Sets and Maps)

When you start working with coding languages you start to realize that you need to store collections of information in variables instead of just one value at a time. In Salesforce you do this through Collections. If you’ve never used collections in Salesforce, I’d like to break down for you how I understand these and help you to get an idea of how collections are used and when you might use them.

Collections (Lists, Sets, Maps)

Apex uses collections to store multiple records. It’s basically just a way to collect records for use later on in your code. You will want to use those records in various ways and you have three different types of collections you can store the records in. Each method has it’s own benefits and drawbacks, but you will probably use them all, so it’s good to become familiar with them.

Working with Lists

A list is an ordered collection that can store records of primitive types (integer, string, etc), collection types (lists, sets,...

Continue Reading...
Close

50% Complete

Get our latest tutorials, tips and tools to help you learn to be an Apex Programmer!

Every week I'll update you on the latest from Apex Coding Academy and you'll get first access to new resources, offers and events.