Is there any specific reason why salesforce did not provide list.contains in apex method
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.
You can now use List.contains() in apex with Spring 18 https://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/rn_apex_new_classes_methods.htm#rn_apex_new_classes_methods