Apex: Converting Lists to Sets, and Sets To Lists

As many Salesforce Apex programmers know, in Salesforce it’s pretty much an unchallenged best practice that all code should be able to handle bulk inserts, updates, etc. When adhering to this best practice, it’s really common to use sets, or lists as parameters in functions. Sometimes, there’s a need to convert between lists, or sets, or maybe even maps. …