1

To get a set of Ids from a list of Contacts for example, I could:

  1. Query for the List of sObjects
  2. Create a map from my list using the constructor
  3. Use the map.KeySet() method to get my set.

Does anyone know of a more efficient design pattern?

I ultimately want a set to pass off to an @future method.

John Thompson
  • 2,109
  • 1
  • 14
  • 26
  • You can also consider using the Queueable interface for your use case, which allows passing non-primitive data types to asynchronous methods: https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_queueing_jobs.htm

    I feel there's a sentiment among the SFDC developer community to stop using @future in favor of Queueable as well.

    – kbentsen May 18 '15 at 20:25

0 Answers0