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