Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Is there any specific reason why salesforce did not provide list.contains in apex method

Asked by Aashish Chaursiya May 2, 2023 804 views 1 answer
Share

About this question

Is there any specific reason why salesforce did not provide list.contains() method.

The below methods are added to List class and are available after Spring 18 release to Sandboxes and Production instances.

System.List Class

1) contains(listElement) Returns true if the list contains the specified element.


2) indexOf(listElement) Returns the index of the first occurrence of the specified element in this list. If this list does not contain the element, returns -1.

Link to official documentation

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.