How to get first element of set using Apex in Salesforce?

Sample Code:

Set<String> setStr = new Set<String> {'abc', 'xyz'};
String first = new List<String> (setStr).get(0); //returns abc

Cheers!!!

No comments:

Post a Comment