Activity Forums Salesforce® Discussions How to convert Set into List in Salesforce?

  • Anuj

    Member
    July 9, 2020 at 2:10 pm

    Set<String> encounteredNames = new Set<String>();
    Set<String> duplicateNames = new Set<String>();
    for(String cd1 : listName) {
    if(encounteredNames.contains(cd1.Name)){
    duplicateNames.add(cd1.Name);
    }else{
    encounteredNames.add(cd1.Name);
    }
    }
    List<String> newlistName = new List<String>(encounteredNames);

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos

Salesforce Interview Questions and Answers - For Freshers and Experienced Candidates

Video in

Learn most important Salesforce Interview Questions and Answers, asked at every interview. These Interview questions will be useful to all entry-level candidates, beginners, interns, and…