Activity Forums Salesforce® Discussions How to check if list contains the specified element in Salesforce ?

  • Anuj

    Member
    October 27, 2020 at 3:28 pm
    1. Define a new Set. Set<String> mySet = new Set<String>();
    2. Use the Set. addAll() method to add all of the List elements to the set. mySet. addAll(myList); .
    3. Use the Set. contains() method to check the Set for the element you're looking for.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos