What is the purpose of List contains in Java?
In Java, the List interface provides a contains(Object obj) method to check if a specified element obj is present in the list. The method returns a boolean value – true if the element is found in the list, false if not. This method can be used to verify the presence of a specific element in the list and take appropriate action based on the return value.